From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754299AbcBZN4f (ORCPT ); Fri, 26 Feb 2016 08:56:35 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:53361 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751449AbcBZN4d (ORCPT ); Fri, 26 Feb 2016 08:56:33 -0500 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: One Thousand Gnomes , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Russ Gorby , linux-serial@vger.kernel.org, Jiri Slaby , Alan Cox Subject: Re: [PATCH] serial: ifx6x60: avoid uninitialized variable use Date: Fri, 26 Feb 2016 14:54:49 +0100 Message-ID: <11867118.gBQtPfGrif@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160226000651.628e28fe@lxorguk.ukuu.org.uk> References: <1456433283-3761559-1-git-send-email-arnd@arndb.de> <20160226000651.628e28fe@lxorguk.ukuu.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:CLbnGwHPXpMbgQokgLi32ssYdCkMGJEQZHzg95bBm2GxlkF2Hcn 0VSO+AAAerTK5EHlhjXG+YhEy/sicuMl+QABIrUSquDas0OQjghK6DY6rPG4+5fiGgmc4Ev br6GSeVHXmcVzew3EztbDwyzw0bqD08leeIEI8/5OPS9UjRS3uXajKDOffmpRzz7OhAC2ct /HCLR9Q/dCMDIutrqQNdA== X-UI-Out-Filterresults: notjunk:1;V01:K0:OwLqKM910sw=:bumgihyqUco06oh8CV5WAf 9kBnoBKktKF0ETri1RoRETDD3A0C0h9kturngRIVPt8yBgwAkbYDcvuDfRGlP4YFCen2o2OLV bcn1uh21F2W1dOJjlyliedjARdjaQFjwsfsFpIAdX3jvKTJQQV79+HKVhRaGVvHAopkhuV4/r H7OISUm6fDPisAhSqDfjWsAOgTNDpOcC/MGdnBveij34lMicv7+pWgx6+Na9fUvTiY5zVY5P/ rxR1rHtsEnFuAGDVSo8mx12LKXfo/cFDoLG6OSyKWM1yUal72qROPbobT6HYjWf8AW/BPoufY p5G41sCu11nsJvoQno2oMVwD9aNAMmNJATgWmKHXTJxfwiHGe0/SMeBlFCv8C6FsRWgSVRwKB IgAd0YJxE+WQbB/HEldOd3Svc5ueDvH6pIhktM//H0PVpYQDS3Huuj1HA67Vg5fqDMqDEk4x1 sM3aTU3JkhNjZ4/zmDz8oH0qncF9g4pa0xhDj4dnDemWPvLZfKEl0sW/Tza+2T6po33BJQ4aX VkZODibfn+psmWX+qQTyXCY6jY2ahCbXtVGQ2iyXeUSwKvrOHBAzbdusZ07GUYI4Ftiu24FmH 5rSV2OFpMCjct18ACN8b3+iqx3PGVUR3lH9yG14CPxMY6Awyp8z2IabGOWdYafCt3gJoZoXWj XvV+0Iv3z0hZmROkZw0M0fVm2m51fz3ldkYltW3D9Rz4ZS8vxLy63RDHrTWI0Q87Mz+S6SlOc VpnEtJfcmbJNsFUW Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 26 February 2016 00:06:51 One Thousand Gnomes wrote: > On Thu, 25 Feb 2016 21:47:57 +0100 > Arnd Bergmann wrote: > > > 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. > > Would it not be far simpler just to set more = 0 at the top of > ifx_spi_complete ? > > That would be simpler, but I generally don't like to do that, because it makes it less obvious where the value is coming from. In this case, it's still not obvious, as I was just guessing what the original intention might have been. Arnd