From patchwork Wed Apr 7 09:21:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 3134 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Wed, 07 Apr 2010 09:21:16 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Wed, 07 Apr 2010 07:15:27 -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 1NzRRk-00079R-5D; Wed, 07 Apr 2010 09:21:16 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757542Ab0DGJVP (ORCPT + 1 other); Wed, 7 Apr 2010 05:21:15 -0400 Received: from mail-fx0-f223.google.com ([209.85.220.223]:47852 "EHLO mail-fx0-f223.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752478Ab0DGJVM (ORCPT ); Wed, 7 Apr 2010 05:21:12 -0400 Received: by fxm23 with SMTP id 23so770941fxm.21 for ; Wed, 07 Apr 2010 02:21:11 -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=sZQZZXRYV75hGIOkvV8G+83lv6f6pnJgRyRAloYMqWE=; b=OkebRbPe7HzLRBeLAUFIN7svCziMvAZcIA/+/6QEz0BDllFV4DoOUkbFQZfkvm7ESK 6uR2NwaeJDbDFPZUbE34wWoS5B0iepzyj9/rysDw2kDwOzvBJ7YpRJRYxl/tcKOra7Li lyx16MrzNaiQFGpQyI+YDDdwHRm/ZraN2aO4Y= 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=d3w10S0EkhRXZkptgG14zyj2ohlLz/VDNAKli7oWuChVTRBlq8BDjLdOVnSxtjTJnM Q2/z9xpa9n13a1sXbazvrWpY4UwQVtphOBXllPIGJi4NyDcWcaLOKuD2uVdKxMNpH8hu Uf+0dSoTsYtNdC+VF4HXslJE1emuo8JygtzD4= Received: by 10.103.4.14 with SMTP id g14mr4644636mui.84.1270632070822; Wed, 07 Apr 2010 02:21:10 -0700 (PDT) Received: from bicker ([196.43.68.50]) by mx.google.com with ESMTPS id 23sm6369680mun.7.2010.04.07.02.21.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 07 Apr 2010 02:21:10 -0700 (PDT) Date: Wed, 7 Apr 2010 12:21:05 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Hans Verkuil , Vaibhav Hiremath , Laurent Pinchart , Muralidharan Karicheri , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] davinci: don't return under lock on error path Message-ID: <20100407092105.GC5157@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 If the kmalloc() failed for "ccdc_cfg = kmalloc(...);" then we would exit with the lock held. I moved the mutex_lock() below the allocation because it isn't protecting anything in that block and allocations are allocations are sometimes slow. Signed-off-by: Dan Carpenter Acked-by: Vaibhav Hiremath --- 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/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index 7cf042f..5c83f90 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c @@ -1824,7 +1824,6 @@ static __init int vpfe_probe(struct platform_device *pdev) goto probe_free_dev_mem; } - mutex_lock(&ccdc_lock); /* Allocate memory for ccdc configuration */ ccdc_cfg = kmalloc(sizeof(struct ccdc_config), GFP_KERNEL); if (NULL == ccdc_cfg) { @@ -1833,6 +1832,8 @@ static __init int vpfe_probe(struct platform_device *pdev) goto probe_free_dev_mem; } + mutex_lock(&ccdc_lock); + strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32); /* Get VINT0 irq resource */ res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);