From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030265AbcDMGpJ (ORCPT ); Wed, 13 Apr 2016 02:45:09 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:40576 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933444AbcDMGpH (ORCPT ); Wed, 13 Apr 2016 02:45:07 -0400 Date: Wed, 13 Apr 2016 09:44:31 +0300 From: Dan Carpenter To: Greg Kroah-Hartman , Anton Blanchard Cc: Jiri Slaby , Paul Gortmaker , Peter Hurley , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] tty: hvc_console: silence unintialized variable warning Message-ID: <20160413064431.GF8092@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index e46d628..325747a 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -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;