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: 272041 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9LJNGhJ004423 for ; Thu, 21 Oct 2010 19:23:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757996Ab0JUTW6 (ORCPT ); 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) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Oct 2010 19:23:17 +0000 (UTC) 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; }