All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/mtd/devices/spear_smi.c: failure test for null rather than negative integer
@ 2012-07-11  8:58 ` Julia Lawall
  0 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2012-07-11  8:58 UTC (permalink / raw)
  To: David Woodhouse, Stefan Roese; +Cc: linux-mtd, kernel-janitors, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

dev_get_platdata returns a pointer, so the failure value would be NULL
rather than a negative integer.

The semantic match that finds this problem is: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,e;
statement S1,S2;
@@

*x = dev_get_platdata(...)
... when != x = e
*if (x < 0) S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/mtd/devices/spear_smi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c
index b85f183..7c10466 100644
--- a/drivers/mtd/devices/spear_smi.c
+++ b/drivers/mtd/devices/spear_smi.c
@@ -935,7 +935,7 @@ static int __devinit spear_smi_probe(struct platform_device *pdev)
 		}
 	} else {
 		pdata = dev_get_platdata(&pdev->dev);
-		if (pdata < 0) {
+		if (!pdata) {
 			ret = -ENODEV;
 			dev_err(&pdev->dev, "no platform data\n");
 			goto err;


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2012-08-24 14:43 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-11  8:58 [PATCH] drivers/mtd/devices/spear_smi.c: failure test for null rather than negative integer Julia Lawall
2012-07-11  8:58 ` Julia Lawall
2012-07-11  8:58 ` Julia Lawall
2012-07-11  9:01 ` viresh kumar
2012-07-11  9:01   ` viresh kumar
2012-07-11  9:01   ` viresh kumar
2012-07-16  9:38 ` Stefan Roese
2012-07-16  9:38   ` Stefan Roese
2012-07-16  9:38   ` Stefan Roese
2012-08-04 20:36 ` [PATCH] drivers/mtd/devices/spear_smi.c: use devm_ functions consistently Julia Lawall
2012-08-04 20:36   ` Julia Lawall
2012-08-04 20:36   ` Julia Lawall
2012-08-24 11:35   ` Artem Bityutskiy
2012-08-24 11:35     ` Artem Bityutskiy
2012-08-24 11:35     ` Artem Bityutskiy
2012-08-24 13:14     ` Stefan Roese
2012-08-24 13:14       ` Stefan Roese
2012-08-24 13:14       ` Stefan Roese
2012-08-24 14:43       ` Artem Bityutskiy
2012-08-24 14:43         ` Artem Bityutskiy
2012-08-24 14:43         ` Artem Bityutskiy
2012-08-17  9:59 ` [PATCH] drivers/mtd/devices/spear_smi.c: failure test for null rather than negative integer Artem Bityutskiy
2012-08-17 10:03   ` Artem Bityutskiy
2012-08-17 10:03   ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.