aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-10-13 05:31:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:37 -0400
commit41ca73229809eb3d173e316d11d3943d49924209 (patch)
tree51ed68f3668a4c625ab9fda66b9b6e1dd6b2b90b /drivers/serial
parent4fa971811cda4036d84574bfb38bd9b22b5c35ec (diff)
drivers/serial/crisv10.c: add missing put_tty_driver
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@diku.dk> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/crisv10.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index bf94a770bb44..a467c77d8a13 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -4419,6 +4419,7 @@ rs_init(void)
4419 rs485_pa_bit)) { 4419 rs485_pa_bit)) {
4420 printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " 4420 printk(KERN_CRIT "ETRAX100LX serial: Could not allocate "
4421 "RS485 pin\n"); 4421 "RS485 pin\n");
4422 put_tty_driver(driver);
4422 return -EBUSY; 4423 return -EBUSY;
4423 } 4424 }
4424#endif 4425#endif
@@ -4427,6 +4428,7 @@ rs_init(void)
4427 rs485_port_g_bit)) { 4428 rs485_port_g_bit)) {
4428 printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " 4429 printk(KERN_CRIT "ETRAX100LX serial: Could not allocate "
4429 "RS485 pin\n"); 4430 "RS485 pin\n");
4431 put_tty_driver(driver);
4430 return -EBUSY; 4432 return -EBUSY;
4431 } 4433 }
4432#endif 4434#endif