diff mbox

[sparc-next] sparc64: vcc: Check for IS_ERR() instead of NULL

Message ID 20170826061205.nkfvekwgzpfgfuhh@mwanda
State Accepted
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter Aug. 26, 2017, 6:12 a.m. UTC
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>

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Aug. 28, 2017, 10:40 p.m. UTC | #1
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Sat, 26 Aug 2017 09:12:05 +0300

> 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>

Applied, thanks Dan.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 5e608173b091..716729129e01 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -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;