Thread (5 messages) 5 messages, 3 authors, 2012-08-22
STALE5054d
Revisions (3)
  1. v1 current
  2. v1 [diff vs current]
  3. v1 [diff vs current]

[PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code

From: Julia Lawall <hidden>
Date: 2012-08-19 08:45:54
Also in: kernel-janitors, linux-samsung-soc, linux-spi, lkml
Subsystem: arm/samsung s3c, s5p and exynos arm architectures, samsung spi drivers, spi subsystem, the rest · Maintainers: Krzysztof Kozlowski, Peter Griffin, Andi Shyti, Mark Brown, Linus Torvalds

From: Julia Lawall <redacted>

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 at 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 <redacted>

---
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;
 		}
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help