[PATCH 1/9] drivers/misc/c2port: correct error-handling code

From: Julia Lawall
Date: Tue Jul 28 2009 - 11:52:46 EST


From: Julia Lawall <julia@xxxxxxx>

c2port_device_register returns an ERR_PTR value in an error case instead of
NULL.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@match exists@
expression x, E;
statement S1, S2;
@@

x = eventfd_fget(...)
... when != x = E
(
* if (x == NULL || ...) S1 else S2
|
* if (x == NULL && ...) S1 else S2
)
// </smpl>

Signed-off-by: Julia Lawall <julia@xxxxxxx>

---
drivers/misc/c2port/c2port-duramar2150.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/c2port/c2port-duramar2150.c b/drivers/misc/c2port/c2port-duramar2150.c
index 338dcc1..585786b 100644
--- a/drivers/misc/c2port/c2port-duramar2150.c
+++ b/drivers/misc/c2port/c2port-duramar2150.c
@@ -128,7 +128,7 @@ static int __init duramar2150_c2port_init(void)

duramar2150_c2port_dev = c2port_device_register("uc",
&duramar2150_c2port_ops, NULL);
- if (!duramar2150_c2port_dev) {
+ if (IS_ERR(duramar2150_c2port_dev)) {
ret = -ENODEV;
goto free_region;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/