All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Kyungmin Park <kyungmin.park@samsung.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Pawel Osciak <p.osciak@samsung.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch 1/3] V4L/DVB: s5p-fimc: add unlock on error path
Date: Thu, 21 Oct 2010 19:22:43 +0000	[thread overview]
Message-ID: <20101021192243.GJ5985@bicker> (raw)

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;
 }

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Kyungmin Park <kyungmin.park@samsung.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Pawel Osciak <p.osciak@samsung.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch 1/3] V4L/DVB: s5p-fimc: add unlock on error path
Date: Thu, 21 Oct 2010 21:22:43 +0200	[thread overview]
Message-ID: <20101021192243.GJ5985@bicker> (raw)

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;
 }

             reply	other threads:[~2010-10-21 19:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 19:22 Dan Carpenter [this message]
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
2010-10-22  6:57   ` Sylwester Nawrocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101021192243.GJ5985@bicker \
    --to=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@infradead.org \
    --cc=p.osciak@samsung.com \
    --cc=s.nawrocki@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.