diff options
| author | Amitay Isaacs <amitay@ozlabs.org> | 2018-11-16 12:14:17 +1100 |
|---|---|---|
| committer | Alistair Popple <alistair@popple.id.au> | 2018-11-16 15:31:40 +1100 |
| commit | e1e7e8f1862eb6e608ed5428975b26fa8c44dc43 (patch) | |
| tree | 9cc478b3753e77007a4eafac00032c935377f2f9 /src | |
| parent | 2dae719022d365da431431f167c86d8a0d9179d4 (diff) | |
| download | pdbg-e1e7e8f1862eb6e608ed5428975b26fa8c44dc43.tar.gz pdbg-e1e7e8f1862eb6e608ed5428975b26fa8c44dc43.zip | |
main: Convert target_selection() to return a boolean
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Alistair Popple <alistair@popple.id.au>
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -600,7 +600,7 @@ void for_each_target_release(char *class) } } -static int target_selection(void) +static bool target_selection(void) { struct pdbg_target *fsi, *pib, *chip, *thread; @@ -613,7 +613,7 @@ static int target_selection(void) case FSI: if (device_node == NULL) { PR_ERROR("FSI backend requires a device type\n"); - return -1; + return false; } if (!strcmp(device_node, "p8")) pdbg_targets_init(&_binary_p8_fsi_dtb_o_start); @@ -625,14 +625,14 @@ static int target_selection(void) pdbg_targets_init(&_binary_p9z_fsi_dtb_o_start); else { PR_ERROR("Invalid device type specified\n"); - return -1; + return false; } break; case KERNEL: if (device_node == NULL) { PR_ERROR("kernel backend requires a device type\n"); - return -1; + return false; } if (!strcmp(device_node, "p8")) pdbg_targets_init(&_binary_p8_kernel_dtb_o_start); @@ -646,7 +646,7 @@ static int target_selection(void) case HOST: if (device_node == NULL) { PR_ERROR("Host backend requires a device type\n"); - return -1; + return false; } if (!strcmp(device_node, "p8")) pdbg_targets_init(&_binary_p8_host_dtb_o_start); @@ -654,7 +654,7 @@ static int target_selection(void) pdbg_targets_init(&_binary_p9_host_dtb_o_start); else { PR_ERROR("Unsupported device type for host backend\n"); - return -1; + return false; } break; #endif @@ -667,7 +667,7 @@ static int target_selection(void) /* parse_options deals with parsing user input, so it should be * impossible to get here */ assert(0); - return -1; + return false; } /* At this point we should have a device-tree loaded. We want @@ -722,7 +722,7 @@ static int target_selection(void) target_unselect(fsi); } - return 0; + return true; } void print_target(struct pdbg_target *target, int level) @@ -814,7 +814,7 @@ int main(int argc, char *argv[]) device_node = default_target(backend); /* Disable unselected targets */ - if (target_selection()) + if (!target_selection()) return 1; atexit(atexit_release); |

