tty: hvc_console: silence unintialized variable warning
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 13 Apr 2016 06:44:31 +0000 (09:44 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Apr 2016 16:26:55 +0000 (09:26 -0700)
If ->get_char() returns a negative error code and that can mean that
"ch" is uninitialized.  The callers of this function expect NO_POLL_CHAR
on error so let's return that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/hvc/hvc_console.c

index 209dad8c96a0cdfa4bc675a7558b6b77a6f892c0..ce864875330e4b0d89c7c6cb2e7207ddab37ff57 100644 (file)
@@ -814,7 +814,7 @@ static int hvc_poll_get_char(struct tty_driver *driver, int line)
 
        n = hp->ops->get_chars(hp->vtermno, &ch, 1);
 
-       if (n == 0)
+       if (n <= 0)
                return NO_POLL_CHAR;
 
        return ch;