aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-02-17 18:20:36 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-26 11:05:48 -0500
commitf4082c6f28a8e77dcb694c6f23de9e533251051d (patch)
tree7118ef180f995d26bc56962bd0a4b035f77d4f6d
parentdc7ffefdcc28a45214aa707fdc3df6a5e611ba09 (diff)
staging: bcm2835/mmal-vchiq: unlock on error in buffer_from_host()
We should unlock before returning on this error path. Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/media/platform/bcm2835/mmal-vchiq.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/media/platform/bcm2835/mmal-vchiq.c b/drivers/staging/media/platform/bcm2835/mmal-vchiq.c
index f0639ee6c8b9..fdfb6a620a43 100644
--- a/drivers/staging/media/platform/bcm2835/mmal-vchiq.c
+++ b/drivers/staging/media/platform/bcm2835/mmal-vchiq.c
@@ -397,8 +397,10 @@ buffer_from_host(struct vchiq_mmal_instance *instance,
397 397
398 /* get context */ 398 /* get context */
399 msg_context = get_msg_context(instance); 399 msg_context = get_msg_context(instance);
400 if (msg_context == NULL) 400 if (!msg_context) {
401 return -ENOMEM; 401 ret = -ENOMEM;
402 goto unlock;
403 }
402 404
403 /* store bulk message context for when data arrives */ 405 /* store bulk message context for when data arrives */
404 msg_context->u.bulk.instance = instance; 406 msg_context->u.bulk.instance = instance;
@@ -454,6 +456,7 @@ buffer_from_host(struct vchiq_mmal_instance *instance,
454 456
455 vchi_service_release(instance->handle); 457 vchi_service_release(instance->handle);
456 458
459unlock:
457 mutex_unlock(&instance->bulk_mutex); 460 mutex_unlock(&instance->bulk_mutex);
458 461
459 return ret; 462 return ret;