[PATCH] s390: ccw_device_probe_console return value
authorPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Wed, 1 Feb 2006 11:06:35 +0000 (03:06 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 1 Feb 2006 16:53:24 +0000 (08:53 -0800)
The return code of ccw_device_probe_console() is not properly handled.  It
should only return a valid ccw device pointer or a error value converted by
ERR_PTR.  Fix the console driver code to check with IS_ERR instead against
NULL.

Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/s390/char/con3215.c
drivers/s390/char/con3270.c
drivers/s390/cio/device.c

index 1f060914cfa429275333377b21dcae3d27937135..606f6ad285a0e3db07ea97f919d467c35818d6c1 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/init.h>
 #include <linux/console.h>
 #include <linux/interrupt.h>
+#include <linux/err.h>
 
 #include <linux/slab.h>
 #include <linux/bootmem.h>
@@ -864,7 +865,7 @@ con3215_init(void)
        }
 
        cdev = ccw_device_probe_console();
-       if (!cdev)
+       if (IS_ERR(cdev))
                return -ENODEV;
 
        raw3215[0] = raw = (struct raw3215_info *)
index c570a9f6ce9cfcd499ca50cdb64cbae6be462ecb..ef607a1de55a30707ac2098eeea64a9f3cc41b24 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/interrupt.h>
 #include <linux/list.h>
 #include <linux/types.h>
+#include <linux/err.h>
 
 #include <asm/ccwdev.h>
 #include <asm/cio.h>
@@ -597,7 +598,7 @@ con3270_init(void)
        }
 
        cdev = ccw_device_probe_console();
-       if (!cdev)
+       if (IS_ERR(cdev))
                return -ENODEV;
        rp = raw3270_setup_console(cdev);
        if (IS_ERR(rp))
index ceebf08e095bc92054197c9f62799cd13ea7583c..0b30921ce60d3273bc7eb3ba17118b9634143400 100644 (file)
@@ -1012,7 +1012,7 @@ ccw_device_probe_console(void)
        int ret;
 
        if (xchg(&console_cdev_in_use, 1) != 0)
-               return NULL;
+               return ERR_PTR(-EBUSY);
        sch = cio_probe_console();
        if (IS_ERR(sch)) {
                console_cdev_in_use = 0;