From patchwork Thu Oct 21 19:22:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 4688 Return-path: Envelope-to: mchehab@pedra Delivery-date: Thu, 21 Oct 2010 18:56:35 -0200 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1P92Be-00052M-Kb for mchehab@pedra; Thu, 21 Oct 2010 18:56:34 -0200 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Thu, 21 Oct 2010 18:56:34 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P90jM-0007Te-9T; Thu, 21 Oct 2010 19:23:16 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757996Ab0JUTW6 (ORCPT + 1 other); Thu, 21 Oct 2010 15:22:58 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:55029 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757987Ab0JUTW4 (ORCPT ); Thu, 21 Oct 2010 15:22:56 -0400 Received: by fxm16 with SMTP id 16so461420fxm.19 for ; Thu, 21 Oct 2010 12:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=hDco7Lm50+4t4GMr0pPoGaScQ8ZrWVQAOYkQ3OlFfXY=; b=vlt+G3s8BrOr6jiIN9WbhWafxBt2i9CKltyALqrBAVCgSiz4o5s5DF2DLJjqjNzWnQ gr+1+hIBdZdIXd0sH99I31atoMBBrHcDHTjxBhTc0PeNnLGm5fOFb0xyuVGyGkwlM1bi GhHOetYX2PQ+uHlObmGUquFP74Rimcze7qzjY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=ZncSZNJFJYNzLm29XGIrAGTsiIm/8f7X1thwAy0DL+lWtdL5KthyMxQZBglj+yAPnn EAltRBDzDyPnZSXpS4iIRhz2MXBpI681KDqahmf2h2dpw1EjzWoaBVuOIt2BbUviDGnb YU1sStpA5PCRb1qJ75IQBTMoDGPr/qxWFVJ+A= Received: by 10.216.243.129 with SMTP id k1mr3245521wer.57.1287688975322; Thu, 21 Oct 2010 12:22:55 -0700 (PDT) Received: from bicker (h3f03.n1.ips.mtn.co.ug [41.210.191.3]) by mx.google.com with ESMTPS id k4sm1308721weq.33.2010.10.21.12.22.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 21 Oct 2010 12:22:53 -0700 (PDT) Date: Thu, 21 Oct 2010 21:22:43 +0200 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Kyungmin Park , Sylwester Nawrocki , Marek Szyprowski , Pawel Osciak , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch 1/3] V4L/DVB: s5p-fimc: add unlock on error path Message-ID: <20101021192243.GJ5985@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: There was an unlock missing if kzalloc() failed. Signed-off-by: Dan Carpenter Acked-by: Sylwester Nawrocki --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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; }