Skip to content

Commit f4082c6

Browse files
Dan Carpentergregkh
authored andcommitted
staging: bcm2835/mmal-vchiq: unlock on error in buffer_from_host()
We should unlock before returning on this error path. Fixes: 7b3ad5a ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dc7ffef commit f4082c6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/staging/media/platform/bcm2835/mmal-vchiq.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,10 @@ buffer_from_host(struct vchiq_mmal_instance *instance,
397397

398398
/* get context */
399399
msg_context = get_msg_context(instance);
400-
if (msg_context == NULL)
401-
return -ENOMEM;
400+
if (!msg_context) {
401+
ret = -ENOMEM;
402+
goto unlock;
403+
}
402404

403405
/* store bulk message context for when data arrives */
404406
msg_context->u.bulk.instance = instance;
@@ -454,6 +456,7 @@ buffer_from_host(struct vchiq_mmal_instance *instance,
454456

455457
vchi_service_release(instance->handle);
456458

459+
unlock:
457460
mutex_unlock(&instance->bulk_mutex);
458461

459462
return ret;

0 commit comments

Comments
 (0)