[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0808231759540.3162@ask.diku.dk>
Date: Sat, 23 Aug 2008 18:00:19 +0200 (CEST)
From: Julia Lawall <julia@...u.dk>
To: starvik@...s.com, jesper.nilsson@...s.com, dev-etrax@...s.com,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] drivers/serial/crisv10.c: add missing put_tty_driver
From: Julia Lawall <julia@...u.dk>
alloc_tty_driver is called at the beginning of the function containing the
lines of code shown in the patch. Thus, put_tty_driver is needed before
returning in the error handling code.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@nr exists@
local idexpression x;
expression E,f;
position p1,p2,p3;
identifier l;
statement S;
@@
x = alloc_tty_driver@p1(...)
...
if (x == NULL) S
... when != E = x
when != put_tty_driver(x)
when != goto l;
(
return \(0\|x\);
|
return@p3 ...;
)
@script:python@
p1 << nr.p1;
p3 << nr.p3;
@@
print "%s: call on line %s not freed or saved before return on line %s" % (p1[0].file,p1[0].line,p3[0].line)
// </smpl>
Signed-off-by: Julia Lawall <julia@...u.dk>
---
drivers/serial/crisv10.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index bf94a77..a467c77 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -4419,6 +4419,7 @@ rs_init(void)
rs485_pa_bit)) {
printk(KERN_CRIT "ETRAX100LX serial: Could not allocate "
"RS485 pin\n");
+ put_tty_driver(driver);
return -EBUSY;
}
#endif
@@ -4427,6 +4428,7 @@ rs_init(void)
rs485_port_g_bit)) {
printk(KERN_CRIT "ETRAX100LX serial: Could not allocate "
"RS485 pin\n");
+ put_tty_driver(driver);
return -EBUSY;
}
#endif
--
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