sparc64: vcc: Check for IS_ERR() instead of NULL
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 26 Aug 2017 06:12:05 +0000 (09:12 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Aug 2017 22:39:55 +0000 (15:39 -0700)
The tty_alloc_driver() function never returns NULL, it returns error
pointers on error.

Fixes: ce808b746325 ("sparc64: vcc: TTY driver initialization and cleanup")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/tty/vcc.c

index 5e608173b0919d07e47c9b2a28435439451c3915..716729129e01bae69e6fba49609b8826c6fb884d 100644 (file)
@@ -1086,9 +1086,9 @@ static int vcc_tty_init(void)
        pr_info("VCC: %s\n", version);
 
        vcc_tty_driver = tty_alloc_driver(VCC_MAX_PORTS, VCC_TTY_FLAGS);
-       if (!vcc_tty_driver) {
+       if (IS_ERR(vcc_tty_driver)) {
                pr_err("VCC: TTY driver alloc failed\n");
-               return -ENOMEM;
+               return PTR_ERR(vcc_tty_driver);
        }
 
        vcc_tty_driver->driver_name = vcc_driver_name;