From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752854AbcADHte (ORCPT ); Mon, 4 Jan 2016 02:49:34 -0500 Received: from mail-ob0-f175.google.com ([209.85.214.175]:33681 "EHLO mail-ob0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751912AbcADHtb (ORCPT ); Mon, 4 Jan 2016 02:49:31 -0500 MIME-Version: 1.0 In-Reply-To: <6037371.CvRA1dDj1l@wuerfel> References: <6037371.CvRA1dDj1l@wuerfel> Date: Mon, 4 Jan 2016 08:49:30 +0100 Message-ID: Subject: Re: [PATCH] gpiolib: always initialize *flags from of_get_named_gpio_flags From: Linus Walleij To: Arnd Bergmann Cc: "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , Alexandre Courbot Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 1, 2016 at 11:40 PM, Arnd Bergmann wrote: > The of_get_named_gpio_flags() function does nothing other than returning > an error when CONFIG_OF_GPIO is disabled, but that causes spurious > warnings about possible use of uninitialized variables in any code that > does not check the of_get_named_gpio_flags() return value before trying > to use the flags: > > drivers/input/misc/rotary_encoder.c: In function 'rotary_encoder_probe': > drivers/input/misc/rotary_encoder.c:223:28: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized] > drivers/power/bq24735-charger.c: In function 'bq24735_charger_probe': > drivers/power/bq24735-charger.c:227:12: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized] > drivers/power/sbs-battery.c: In function 'sbs_probe': > drivers/power/sbs-battery.c:782:17: warning: 'gpio_flags' may be used uninitialized in this function [-Wmaybe-uninitialized] > > This changes the behavior of the inline helper to set the flags to zero > when OF_GPIO is disabled, to avoid the warnings. In all cases I've > encountered, we don't actually get to the place that uses the flags > if CONFIG_OF is disabled because we won't enter the DT parser code. > > Signed-off-by: Arnd Bergmann Patch applied! Yours, Linus Walleij