From patchwork Tue Mar 9 18:06:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: m-karicheri2@ti.com X-Patchwork-Id: 2900 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Tue, 09 Mar 2010 18:06:18 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Tue, 09 Mar 2010 15:09:22 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Np3ow-0001RV-12; Tue, 09 Mar 2010 18:06:18 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755259Ab0CISGR (ORCPT + 1 other); Tue, 9 Mar 2010 13:06:17 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:52968 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751209Ab0CISGQ (ORCPT ); Tue, 9 Mar 2010 13:06:16 -0500 Received: from dlep34.itg.ti.com ([157.170.170.115]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o29I6F5O000685 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 9 Mar 2010 12:06:15 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id o29I6EgB012268; Tue, 9 Mar 2010 12:06:14 -0600 (CST) Received: from gt516km11.gt.design.ti.com (gt516km11.gt.design.ti.com [158.218.100.179]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id o29I6EZ10054; Tue, 9 Mar 2010 12:06:14 -0600 (CST) Received: from gt516km11.gt.design.ti.com (localhost.localdomain [127.0.0.1]) by gt516km11.gt.design.ti.com (8.13.1/8.13.1) with ESMTP id o29I6D7H030203; Tue, 9 Mar 2010 13:06:13 -0500 Received: (from a0868495@localhost) by gt516km11.gt.design.ti.com (8.13.1/8.13.1/Submit) id o29I6D7A030200; Tue, 9 Mar 2010 13:06:13 -0500 X-Authentication-Warning: gt516km11.gt.design.ti.com: a0868495 set sender to m-karicheri2@ti.com using -f From: m-karicheri2@ti.com To: linux-media@vger.kernel.org Cc: Murali Karicheri Subject: [PATCH] V4L: vpfe_capture - free ccdc_lock when memory allocation fails Date: Tue, 9 Mar 2010 13:06:13 -0500 Message-Id: <1268157973-30166-1-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.6.0.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Murali Karicheri This patch fixes a bug in vpfe_probe() that doesn't call mutex_unlock() if memory allocation for ccdc_cfg fails. See also the smatch warning report from Dan Carpenter that shows this as an issue. Signed-off-by: Murali Karicheri --- drivers/media/video/davinci/vpfe_capture.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index 885cd54..91f665b 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c @@ -1829,7 +1829,7 @@ static __init int vpfe_probe(struct platform_device *pdev) if (NULL == ccdc_cfg) { v4l2_err(pdev->dev.driver, "Memory allocation failed for ccdc_cfg\n"); - goto probe_free_dev_mem; + goto probe_free_lock; } strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32); @@ -1981,8 +1981,9 @@ probe_out_video_release: probe_out_release_irq: free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); probe_free_ccdc_cfg_mem: - mutex_unlock(&ccdc_lock); kfree(ccdc_cfg); +probe_free_lock: + mutex_unlock(&ccdc_lock); probe_free_dev_mem: kfree(vpfe_dev); return ret;