aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-10-15 09:00:09 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-10-19 13:32:40 -0400
commit6cc0cc4a35337b48e09c82c5f3fb83534884fca8 (patch)
tree67ea9e34e23f102bb67730bf7a690981831f5756
parent08be7b2bc7393d5cf4beb00aecb5eb9e5cde5f85 (diff)
SERIAL: ioc3_serial: Return -ENOMEM on memory allocation failure
In this code, 0 is returned on memory allocation failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression ret; expression x,e1,e2,e3; @@ ret = 0 ... when != ret = e1 *x = \(kmalloc\|kcalloc\|kzalloc\)(...) ... when != ret = e2 if (x == NULL) { ... when != ret = e3 return ret; } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> To: Pat Gefre <pfg@sgi.com> Cc: kernel-janitors@vger.kernel.org Cc: linux-ia64@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/1704/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--drivers/serial/ioc3_serial.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
index 93de907b1208..800c54602339 100644
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -2044,6 +2044,7 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
2044 if (!port) { 2044 if (!port) {
2045 printk(KERN_WARNING 2045 printk(KERN_WARNING
2046 "IOC3 serial memory not available for port\n"); 2046 "IOC3 serial memory not available for port\n");
2047 ret = -ENOMEM;
2047 goto out4; 2048 goto out4;
2048 } 2049 }
2049 spin_lock_init(&port->ip_lock); 2050 spin_lock_init(&port->ip_lock);