openocd: remove NULL comparisons with checkpatch [2/2]

Patch generated automatically through a modified checkpatch that
detects the patterns
	if (NULL == symbol)
	if (NULL != symbol)
and through flags "--types COMPARISON_TO_NULL --fix-inplace".

The unmodified checkpatch detects this pattern as Yoda condition,
but it's odd fixing it as Yoda condition and then again as NULL
comparison. This triggered the modification to the script.

Change-Id: I5fe984a85e9c4fc799f049211797aef891ebce18
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6352
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2021-07-03 21:47:55 +02:00
parent 3917823187
commit 0a1f904707
12 changed files with 20 additions and 20 deletions

View File

@@ -91,7 +91,7 @@ COMMAND_HANDLER(handle_adapter_list_command)
return ERROR_COMMAND_SYNTAX_ERROR;
command_print(CMD, "The following debug adapters are available:");
for (unsigned i = 0; NULL != adapter_drivers[i]; i++) {
for (unsigned i = 0; adapter_drivers[i]; i++) {
const char *name = adapter_drivers[i]->name;
command_print(CMD, "%u: %s", i + 1, name);
}
@@ -113,11 +113,11 @@ COMMAND_HANDLER(handle_adapter_driver_command)
if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0')
return ERROR_COMMAND_SYNTAX_ERROR;
for (unsigned i = 0; NULL != adapter_drivers[i]; i++) {
for (unsigned i = 0; adapter_drivers[i]; i++) {
if (strcmp(CMD_ARGV[0], adapter_drivers[i]->name) != 0)
continue;
if (NULL != adapter_drivers[i]->commands) {
if (adapter_drivers[i]->commands) {
retval = register_commands(CMD_CTX, NULL,
adapter_drivers[i]->commands);
if (retval != ERROR_OK)

View File

@@ -67,7 +67,7 @@ void jtag_queue_command(struct jtag_command *cmd)
struct jtag_command **last_cmd = next_command_pointer;
assert(last_cmd);
assert(NULL == *last_cmd);
assert(!*last_cmd);
*last_cmd = cmd;
/* store location where the next command pointer will be stored */

View File

@@ -785,7 +785,7 @@ static int vsllink_check_usb_strings(
char desc_string[256];
int retval;
if (NULL != versaloon_interface.usb_setting.serialstring) {
if (versaloon_interface.usb_setting.serialstring) {
retval = libusb_get_string_descriptor_ascii(usb_device_handle,
usb_desc->iSerialNumber, (unsigned char *)desc_string,
sizeof(desc_string));

View File

@@ -472,7 +472,7 @@ static bool usb_read(unsigned char *buffer, int size, int *bytes_read,
{
int result;
if (NULL == xds110.dev || NULL == buffer || NULL == bytes_read)
if (!xds110.dev || !buffer || !bytes_read)
return false;
/* Force a non-zero timeout to prevent blocking */
@@ -491,7 +491,7 @@ static bool usb_write(unsigned char *buffer, int size, int *written)
int result = LIBUSB_SUCCESS;
int retries = 0;
if (NULL == xds110.dev || NULL == buffer)
if (!xds110.dev || !buffer)
return false;
result = libusb_bulk_transfer(xds110.dev, xds110.endpoint_out, buffer,
@@ -1037,7 +1037,7 @@ static bool ocd_dap_request(uint8_t *dap_requests, uint32_t request_size,
bool success;
if (NULL == dap_requests || NULL == dap_results)
if (!dap_requests || !dap_results)
return false;
xds110.write_payload[0] = OCD_DAP_REQUEST;
@@ -1062,7 +1062,7 @@ static bool ocd_scan_request(uint8_t *scan_requests, uint32_t request_size,
bool success;
if (NULL == scan_requests || NULL == scan_results)
if (!scan_requests || !scan_results)
return false;
xds110.write_payload[0] = OCD_SCAN_REQUEST;