[PATCH V2 1/5] staging: vchiq_arm: Drop unnecessary NULL check

Stefan Wahren wahrenst at gmx.net
Thu Apr 25 09:58:48 PDT 2024


Looking at the handling of service instance within the VCHIQ
driver shows that it's not possible that service_callback is
called with instance is a NULL pointer. So drop the unnecessary
NULL check and fix:

vchiq_arm.c:1109 service_callback() warn:
  variable dereferenced before check 'instance' (see line 1091)

Reported-by: kernel test robot <lkp at intel.com>
Closes: https://lore.kernel.org/linux-arm-kernel/202404230315.vx7ESZ3r-lkp@intel.com/
Signed-off-by: Stefan Wahren <wahrenst at gmx.net>
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index c06232fcb0fb..297af1d80b12 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1106,7 +1106,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,

 	user_service = (struct user_service *)service->base.userdata;

-	if (!instance || instance->closing) {
+	if (instance->closing) {
 		rcu_read_unlock();
 		return 0;
 	}
--
2.34.1




More information about the linux-arm-kernel mailing list