[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1208221342240.1991@hadrien>
Date: Wed, 22 Aug 2012 13:42:47 +0200 (CEST)
From: Julia Lawall <julia.lawall@...6.fr>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
cc: Kukjin Kim <kgene.kim@...sung.com>,
'Julia Lawall' <Julia.Lawall@...6.fr>,
'Ben Dooks' <ben-linux@...ff.org>,
kernel-janitors@...r.kernel.org,
'Grant Likely' <grant.likely@...retlab.ca>,
linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org,
spi-devel-general@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code
From: Julia Lawall <Julia.Lawall@...6.fr>
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/)
// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@...6.fr>
---
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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists