public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/3] V4L/DVB: s5p-fimc: add unlock on error path
@ 2010-10-21 19:22 Dan Carpenter
  2010-10-22  6:57 ` Sylwester Nawrocki
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-10-21 19:22 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Kyungmin Park, Sylwester Nawrocki, Marek Szyprowski, Pawel Osciak,
	linux-media, kernel-janitors

There was an unlock missing if kzalloc() failed.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index 1802701..8335045 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -1326,16 +1326,18 @@ static int fimc_m2m_open(struct file *file)
 	 * is already opened.
 	 */
 	if (fimc->vid_cap.refcnt > 0) {
-		mutex_unlock(&fimc->lock);
-		return -EBUSY;
+		err = -EBUSY;
+		goto err_unlock;
 	}
 
 	fimc->m2m.refcnt++;
 	set_bit(ST_OUTDMA_RUN, &fimc->state);
 
 	ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
-	if (!ctx)
-		return -ENOMEM;
+	if (!ctx) {
+		err = -ENOMEM;
+		goto err_unlock;
+	}
 
 	file->private_data = ctx;
 	ctx->fimc_dev = fimc;
@@ -1355,6 +1357,7 @@ static int fimc_m2m_open(struct file *file)
 		kfree(ctx);
 	}
 
+err_unlock:
 	mutex_unlock(&fimc->lock);
 	return err;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-22  6:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-21 19:22 [patch 1/3] V4L/DVB: s5p-fimc: add unlock on error path Dan Carpenter
2010-10-22  6:57 ` Sylwester Nawrocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox