From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755321AbbKXWEb (ORCPT ); Tue, 24 Nov 2015 17:04:31 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:62401 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754341AbbKXWE1 (ORCPT ); Tue, 24 Nov 2015 17:04:27 -0500 From: Arnd Bergmann To: gregkh@linuxfoundation.org Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Jun , channing , Russ Gorby , Vasiliy Kulikov Subject: [PATCH] serial: ifx6x60: avoid uninitialized variable use Date: Tue, 24 Nov 2015 23:04 +0100 Message-ID: <3244991.qANsXoqoKs@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:xkU5PtZha1WJcMLQnwosIC9FxF7kDpulfFKi5bluIK7UEkpAKg2 78Dvdsi2otl9QRBnzdq6TVNh5gm3MhdycxgUawPFy7IzgoMpott+IUyzcp5ZwX249XFWOi6 DwpUeBn3O08Pcq5aY09Y6eSG/hH26CKFSiBKM3qSoOg/aNBSAqPObG0NNHgsJvB4jAmBOic ZlhP1Gz6rKsVhOXYwX/lg== X-UI-Out-Filterresults: notjunk:1;V01:K0:AKEJWrKgYck=:5Nfd4XmeZYyBaP/ykRfLx+ uS+7RnN9yb9vPkw5ErWYUJvv8f2yfjzR1C07QS7Hl+/wCyY/Dx/O1vMHzbGOVojYdbzgnYOvN AueP7NcbKZat/Pjq7lL9M9f/gPKz3jz/jR4V3u5+62a3ocrEtazfHFCtJJlovkPed4OFikrDB mMcH+vXHt5jyAQQ8EehyqranF3dkXdcrD1Rn+abYZBViUAFKxydOhydcccopICeVSR2qOfhHQ jTQ8Cuqadu41mxeLenLqcSWlJaZlvCeWQqnudhoFfi9J/dinL6EDN1eg5iQbmxlXxZZ2EbDD1 JDKJ/l08tKl4WpqTnA329S28kZI1NN2Pkho+vm0PNBXNdJP5euGCfWp+qVg3HgDu2tILL6mLZ OTwUzfkkkCPFOX1/zv2vMLax+S1jR1FsIao4aAOXGInTawOPZhCvFWWcl7TUw1QD/LHVIkJWa htA+qGbFPajYvRajlY9ceXabqcJ3Y6CVUkc86jZq3UgdbhdYCJ0gz3PTk7ZrGFqn07d7ecxzC udlEKN9SBmOU/ETJ5wjcB2JCGsLmqOUj42Zet6BnuP426KnLESB1I833lPrywjXPepqCa2pYM GvgAU+Tzfk0HdiXLk8ao9wW3C3RE2N0Yb9FVkfQPybpuvB4BsNVjbPgJFqO3NAMrYJWwSsLLN s0q9+2iFrZi5E3vt1V1QCzbIxbXLc5XY047ifqpXyrpS5mdzg8KoCb0ozTQb1Iu4FOkU7/bqs lh6lRNBiC3bbKYWz Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc warns about a potential use of an uninitialized variable in this driver: drivers/tty/serial/ifx6x60.c: In function 'ifx_spi_complete': drivers/tty/serial/ifx6x60.c:713:6: warning: 'more' may be used uninitialized in this function [-Wmaybe-uninitialized] if (more || ifx_dev->spi_more || queue_length > 0 || Unlike a lot of other such warnings, this one is correct and describes an actual problem in the handling of the "IFX_SPI_HEADER_F" result code. This appears to be a result from a restructuring of the driver that dates back to before it was merged in the kernel, so it's impossible to know where it went wrong. I also don't know what that result code means, so I have no idea if setting 'more' to zero is the correct solution, but at least it makes the behavior reproducible rather than depending on whatever happens to be on the kernel stack. Signed-off-by: Arnd Bergmann --- Cc everyone who contributed non-cleanup patches to this driver, maybe someone has more insight into the operation of the driver than I have and can comment on whether this is the right fix or not. diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index 88246f7e435a..5d18442e42ba 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -397,6 +397,7 @@ static int ifx_spi_decode_spi_header(unsigned char *buffer, int *length, *received_cts = 0; return IFX_SPI_HEADER_0; } else if (h1 == 0xffff && h2 == 0xffff) { + *received_cts = 0; /* spi_slave_cts remains as it was */ return IFX_SPI_HEADER_F; }