diff mbox series

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

Message ID 20240425165852.6681-2-wahrenst@gmx.net (mailing list archive)
State New, archived
Headers show
Series staging: vc04_services: Minor clean-ups | expand

Commit Message

Stefan Wahren April 25, 2024, 4:58 p.m. UTC
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@intel.com>
Closes: https://lore.kernel.org/linux-arm-kernel/202404230315.vx7ESZ3r-lkp@intel.com/
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.34.1

Comments

Umang Jain April 26, 2024, 4:22 a.m. UTC | #1
Hi Stefan,

Thank you for the patch

On 25/04/24 10:28 pm, Stefan Wahren wrote:
> 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@intel.com>
> Closes: https://lore.kernel.org/linux-arm-kernel/202404230315.vx7ESZ3r-lkp@intel.com/
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   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
>
diff mbox series

Patch

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;
 	}