Message ID | 20231102210603.1201311-2-umang.jain@ideasonboard.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | staging: vc04: Smatch analysis fixes | expand |
Am 02.11.23 um 22:06 schrieb Umang Jain: > The handle_to_service() helper can return NULL, so service pointer > can indeed be set to NULL. Hence, do not log through service pointer, > use the vchiq_instance function argument to get access to the > struct device. I'm not sure but the change looks like fix, which deserve a Fixes tag to me. > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> > --- > .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c > index 39b857da2d42..8a9eb0101c2e 100644 > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c > @@ -245,7 +245,7 @@ find_service_by_handle(struct vchiq_instance *instance, unsigned int handle) > return service; > } > rcu_read_unlock(); > - vchiq_log_debug(service->state->dev, VCHIQ_CORE, > + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, > "Invalid service handle 0x%x", handle); > return NULL; > } > @@ -287,7 +287,7 @@ find_service_for_instance(struct vchiq_instance *instance, unsigned int handle) > return service; > } > rcu_read_unlock(); > - vchiq_log_debug(service->state->dev, VCHIQ_CORE, > + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, > "Invalid service handle 0x%x", handle); > return NULL; > } > @@ -310,7 +310,7 @@ find_closed_service_for_instance(struct vchiq_instance *instance, unsigned int h > return service; > } > rcu_read_unlock(); > - vchiq_log_debug(service->state->dev, VCHIQ_CORE, > + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, > "Invalid service handle 0x%x", handle); > return service; > }
Hi Stefan, On 11/6/23 1:43 AM, Stefan Wahren wrote: > Am 02.11.23 um 22:06 schrieb Umang Jain: >> The handle_to_service() helper can return NULL, so service pointer >> can indeed be set to NULL. Hence, do not log through service pointer, >> use the vchiq_instance function argument to get access to the >> struct device. > I'm not sure but the change looks like fix, which deserve a Fixes tag > to me. Sounds good to me. I have the tag to the patch and this series is subsumed under "[PATCH 0/9] staging: vc04_services: Smatch fixes and remove custom logging". >> >> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> >> --- >> .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git >> a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c >> b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c >> index 39b857da2d42..8a9eb0101c2e 100644 >> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c >> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c >> @@ -245,7 +245,7 @@ find_service_by_handle(struct vchiq_instance >> *instance, unsigned int handle) >> return service; >> } >> rcu_read_unlock(); >> - vchiq_log_debug(service->state->dev, VCHIQ_CORE, >> + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, >> "Invalid service handle 0x%x", handle); >> return NULL; >> } >> @@ -287,7 +287,7 @@ find_service_for_instance(struct vchiq_instance >> *instance, unsigned int handle) >> return service; >> } >> rcu_read_unlock(); >> - vchiq_log_debug(service->state->dev, VCHIQ_CORE, >> + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, >> "Invalid service handle 0x%x", handle); >> return NULL; >> } >> @@ -310,7 +310,7 @@ find_closed_service_for_instance(struct >> vchiq_instance *instance, unsigned int h >> return service; >> } >> rcu_read_unlock(); >> - vchiq_log_debug(service->state->dev, VCHIQ_CORE, >> + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, >> "Invalid service handle 0x%x", handle); >> return service; >> } >
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 39b857da2d42..8a9eb0101c2e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -245,7 +245,7 @@ find_service_by_handle(struct vchiq_instance *instance, unsigned int handle) return service; } rcu_read_unlock(); - vchiq_log_debug(service->state->dev, VCHIQ_CORE, + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, "Invalid service handle 0x%x", handle); return NULL; } @@ -287,7 +287,7 @@ find_service_for_instance(struct vchiq_instance *instance, unsigned int handle) return service; } rcu_read_unlock(); - vchiq_log_debug(service->state->dev, VCHIQ_CORE, + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, "Invalid service handle 0x%x", handle); return NULL; } @@ -310,7 +310,7 @@ find_closed_service_for_instance(struct vchiq_instance *instance, unsigned int h return service; } rcu_read_unlock(); - vchiq_log_debug(service->state->dev, VCHIQ_CORE, + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, "Invalid service handle 0x%x", handle); return service; }
The handle_to_service() helper can return NULL, so service pointer can indeed be set to NULL. Hence, do not log through service pointer, use the vchiq_instance function argument to get access to the struct device. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> --- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)