From patchwork Wed Aug 22 11:42:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 1361061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 786AB3FC71 for ; Wed, 22 Aug 2012 11:46:21 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T49Ks-0008Po-Ri; Wed, 22 Aug 2012 11:42:58 +0000 Received: from mail1-relais-roc.national.inria.fr ([192.134.164.82]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T49Kl-0008Oj-6G for linux-arm-kernel@lists.infradead.org; Wed, 22 Aug 2012 11:42:55 +0000 X-IronPort-AV: E=Sophos;i="4.77,808,1336341600"; d="scan'208";a="170506400" Received: from technetium.rsr.lip6.fr ([132.227.76.37]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Aug 2012 13:42:48 +0200 Date: Wed, 22 Aug 2012 13:42:47 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Mark Brown Subject: Re: [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code In-Reply-To: <20120822114015.GI7995@opensource.wolfsonmicro.com> Message-ID: References: <1345365870-29831-1-git-send-email-Julia.Lawall@lip6.fr> <1345365870-29831-15-git-send-email-Julia.Lawall@lip6.fr> <1b3201cd8049$e753f720$b5fbe560$%kim@samsung.com> <20120822114015.GI7995@opensource.wolfsonmicro.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.1 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.134.164.82 listed in list.dnswl.org] 0.8 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Kukjin Kim , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, 'Grant Likely' , 'Julia Lawall' , linux-samsung-soc@vger.kernel.org, 'Ben Dooks' , spi-devel-general@lists.sourceforge.net, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Julia Lawall Initialize return variable before exiting on an error path. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- Perhaps -EINVAL is not the right value in this case. drivers/spi/spi-s3c24xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c index 8ee7d79..a2a080b 100644 --- a/drivers/spi/spi-s3c24xx.c +++ b/drivers/spi/spi-s3c24xx.c @@ -611,6 +611,7 @@ static int __devinit s3c24xx_spi_probe(struct platform_device *pdev) if (!pdata->set_cs) { if (pdata->pin_cs < 0) { dev_err(&pdev->dev, "No chipselect pin\n"); + err = -EINVAL; goto err_register; }