Skip to contentSkip to conversation

staging: vc04_services: Avoid NULL comparison

PATCH Superseded Nachammai Karuppiah 3 participants 5 messages Oct 3, 2019 – Oct 4, 2019

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vc04_services: Avoid NULL comparison

Remove NULL comparison. Issue found using checkpatch.pl

---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +1 -1
index 17a4f2c..a2268d5 100644
@@ -628,7 +628,7 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
 		}
 	}
 
-	return (service != NULL) ? 0 : -1;
+	return (service) ? 0 : -1;
 }
 EXPORT_SYMBOL(vchi_service_open);
 
Signature · 1 line
2.7.4
#1 lore raw

Hi Nachammai,

Am 03.10.19 um 19:01 schrieb Nachammai Karuppiah:

Quoted 4 lines

Remove NULL comparison. Issue found using checkpatch.pl

---

could you please add [email protected] to CC?

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, · line 631

Quoted 13 lines
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +1 -1
index 17a4f2c..a2268d5 100644
@@ -628,7 +628,7 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
 		}
 	}
 
-	return (service != NULL) ? 0 : -1;
+	return (service) ? 0 : -1;

Do you think the braces are still necessary in this case?

Btw a quick find -type f | xargs grep "!= NULL" within the vc04_services/interface reveals more occurences. Would be nice to fix them all and for once.

Thanks
Stefan

Quoted 3 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +0 -0
 }
 EXPORT_SYMBOL(vchi_service_open);
 
#2 lore raw
Quoted 20 lines · Stefan Wahren

Hi Nachammai,

Am 03.10.19 um 19:01 schrieb Nachammai Karuppiah:

Quoted 4 lines

Remove NULL comparison. Issue found using checkpatch.pl

---

could you please add [email protected] to CC?

Quoted 11 lines
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +0 -0
index 17a4f2c..a2268d5 100644
@@ -628,7 +628,7 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
              }
      }
 
Quoted 8 lines

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, · line 631

Quoted 2 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +1 -1
-     return (service != NULL) ? 0 : -1;
+     return (service) ? 0 : -1;

Do you think the braces are still necessary in this case?

Btw a quick find -type f | xargs grep "!= NULL" within the vc04_services/interface reveals more occurences. Would be nice to fix them all and for once.

Will get rid of the braces.
Sure, I will remove all NULL comparisons in vc04_services/interface and update this patch.

Thanks,
Nachammai

Quoted 7 lines

Thanks
Stefan

Quoted 3 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +0 -0
 }
 EXPORT_SYMBOL(vchi_service_open);
 
#3 lore raw
In reply to Nachammai Karuppiah
Quoted 12 lines · Nachammai Karuppiah

Remove NULL comparison. Issue found using checkpatch.pl

---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +0 -0
index 17a4f2c..a2268d5 100644

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, · line 631

Quoted 5 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +1 -1
@@ -628,7 +628,7 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
 		}
 	}
 
-	return (service != NULL) ? 0 : -1;
+	return (service) ? 0 : -1;

You don't need the parentheses.

julia

Quoted 11 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +0 -1
 }
 EXPORT_SYMBOL(vchi_service_open);
 
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1570122078-23942-1-git-send-email-nachukannan%40gmail.com.

#4 lore raw
Quoted 20 lines · Julia Lawall
Quoted 15 lines · Nachammai Karuppiah

Remove NULL comparison. Issue found using checkpatch.pl

---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +0 -0
index 17a4f2c..a2268d5 100644
@@ -628,7 +628,7 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
              }
      }
 
Quoted 5 lines

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, · line 631

Quoted 2 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +1 -1
-     return (service != NULL) ? 0 : -1;
+     return (service) ? 0 : -1;

You don't need the parentheses.

Yes, will remove the parenthesis.

Nachammai

Quoted 13 lines

julia

Quoted 11 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +0 -1
 }
 EXPORT_SYMBOL(vchi_service_open);
 
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1570122078-23942-1-git-send-email-nachukannan%40gmail.com.