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

Patch generated automatically through the new checkpatch with
flags "--types COMPARISON_TO_NULL --fix-inplace".
This only fixes the comparisons
	if (symbol == NULL)
	if (symbol != NULL)
The case of NULL on the left side of the comparison is not tested.

Some automatic fix is incorrect and has been massaged by hands:
	-	if (*psig == NULL)
	+	if (*!psig)
changed as
	+	if (!*psig)

Change-Id: If4a1e2b4e547e223532e8e3d9da89bf9cb382ce6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6351
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2021-07-03 21:29:32 +02:00
parent 08ee7bb982
commit 3917823187
71 changed files with 181 additions and 181 deletions

View File

@@ -306,13 +306,13 @@ int rtos_thread_packet(struct connection *connection, char const *packet, int pa
struct target *target = get_target_from_connection(connection);
if (strncmp(packet, "qThreadExtraInfo,", 17) == 0) {
if ((target->rtos) && (target->rtos->thread_details != NULL) &&
if ((target->rtos) && (target->rtos->thread_details) &&
(target->rtos->thread_count != 0)) {
threadid_t threadid = 0;
int found = -1;
sscanf(packet, "qThreadExtraInfo,%" SCNx64, &threadid);
if ((target->rtos) && (target->rtos->thread_details != NULL)) {
if ((target->rtos) && (target->rtos->thread_details)) {
int thread_num;
for (thread_num = 0; thread_num < target->rtos->thread_count; thread_num++) {
if (target->rtos->thread_details[thread_num].threadid == threadid) {
@@ -416,7 +416,7 @@ int rtos_thread_packet(struct connection *connection, char const *packet, int pa
threadid_t threadid;
int found = -1;
sscanf(packet, "T%" SCNx64, &threadid);
if ((target->rtos) && (target->rtos->thread_details != NULL)) {
if ((target->rtos) && (target->rtos->thread_details)) {
int thread_num;
for (thread_num = 0; thread_num < target->rtos->thread_count; thread_num++) {
if (target->rtos->thread_details[thread_num].threadid == threadid) {
@@ -564,7 +564,7 @@ int rtos_set_reg(struct connection *connection, int reg_num,
struct target *target = get_target_from_connection(connection);
int64_t current_threadid = target->rtos->current_threadid;
if ((target->rtos) &&
(target->rtos->type->set_reg != NULL) &&
(target->rtos->type->set_reg) &&
(current_threadid != -1) &&
(current_threadid != 0)) {
return target->rtos->type->set_reg(target->rtos, reg_num, reg_value);
@@ -657,7 +657,7 @@ static int rtos_try_next(struct target *target)
int rtos_update_threads(struct target *target)
{
if ((target->rtos) && (target->rtos->type != NULL))
if ((target->rtos) && (target->rtos->type))
target->rtos->type->update_threads(target->rtos);
return ERROR_OK;
}