From: Dan Carpenter Date: Fri, 17 Feb 2017 23:20:36 +0000 (+0300) Subject: staging: bcm2835/mmal-vchiq: unlock on error in buffer_from_host() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f4082c6f28a8e77dcb694c6f23de9e533251051d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Greg Kroah-Hartman --- 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, /* get context */ msg_context = get_msg_context(instance); - if (msg_context == NULL) - return -ENOMEM; + if (!msg_context) { + ret = -ENOMEM; + goto unlock; + } /* store bulk message context for when data arrives */ msg_context->u.bulk.instance = instance; @@ -454,6 +456,7 @@ buffer_from_host(struct vchiq_mmal_instance *instance, vchi_service_release(instance->handle); +unlock: mutex_unlock(&instance->bulk_mutex); return ret;