diff options
author | Joel Stanley <joel@jms.id.au> | 2017-11-16 14:21:19 +1030 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2017-11-22 10:35:08 +1100 |
commit | 58950eef124fcb37687f856fc5ee7936cb4e31cc (patch) | |
tree | 4800ddb59c55727f167fec04dd025e836280d25d /src | |
parent | c056b947eb43842c7f752af6b67cca983d316a82 (diff) | |
download | pdbg-58950eef124fcb37687f856fc5ee7936cb4e31cc.tar.gz pdbg-58950eef124fcb37687f856fc5ee7936cb4e31cc.zip |
Error out when no device type is specified
The host and FSI backend require the device type to be specified. When
a user forgets, we pass a null pointer to strcmp and segfault.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -867,6 +867,10 @@ static int target_select(void) break; case FSI: + if (device_node == NULL) { + PR_ERROR("FSI backend requires a device type\n"); + return -1; + } if (!strcmp(device_node, "p8")) targets_init(&_binary_p8_fsi_dtb_o_start); else if (!strcmp(device_node, "p9w") || !strcmp(device_node, "witherspoon")) @@ -890,6 +894,10 @@ static int target_select(void) break; case HOST: + if (device_node == NULL) { + PR_ERROR("Host backend requires a device type\n"); + return -1; + } if (!strcmp(device_node, "p8")) targets_init(&_binary_p8_host_dtb_o_start); else if (!strcmp(device_node, "p9")) |