diff mbox series

[3/9] staging: vc04_services: bcm2835-camera: Remove redundant null check

Message ID 20231107095156.365492-4-umang.jain@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series staging: vc04_services: Smatch fixes and remove custom logging | expand

Commit Message

Umang Jain Nov. 7, 2023, 9:51 a.m. UTC
Remove the buf pointer null check in buffer_cb() as it can never be
NULL. buffer_cb() is always called with a valid mmal_buf pointer
(which is NULL checked) from which, struct vb2_mmal_buf buf pointer
is derived, using container_of macro.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c  | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index e6e89784d84b..4b2b8f3bf903 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -333,11 +333,8 @@  static void buffer_cb(struct vchiq_mmal_instance *instance,
 		 mmal_buf->pts);
 
 	if (status) {
-		/* error in transfer */
-		if (buf) {
-			/* there was a buffer with the error so return it */
-			vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
-		}
+		/* There was a buffer with the error so return it. */
+		vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
 		return;
 	}