From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752646AbcKIIoq (ORCPT ); Wed, 9 Nov 2016 03:44:46 -0500 Received: from mail-qk0-f174.google.com ([209.85.220.174]:36590 "EHLO mail-qk0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752376AbcKIIom (ORCPT ); Wed, 9 Nov 2016 03:44:42 -0500 MIME-Version: 1.0 In-Reply-To: <20161108134035.1764500-1-arnd@arndb.de> References: <20161108134035.1764500-1-arnd@arndb.de> From: Linus Walleij Date: Wed, 9 Nov 2016 09:44:41 +0100 Message-ID: Subject: Re: [PATCH] ACPI / gpio: avoid warning for gpio hogging code To: Arnd Bergmann Cc: Alexandre Courbot , Mika Westerberg , "Rafael J. Wysocki" , Dmitry Torokhov , Wei Yongjun , Christophe Ricard , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uA98ixTU013032 On Tue, Nov 8, 2016 at 2:40 PM, Arnd Bergmann wrote: > The newly added acpi_gpiochip_scan_gpios function produces a few harmless > warnings: > > drivers/gpio/gpiolib-acpi.c: In function ‘acpi_gpiochip_add’: > drivers/gpio/gpiolib-acpi.c:925:7: error: ‘dflags’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > drivers/gpio/gpiolib-acpi.c:925:9: error: ‘lflags’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > > The problem is that he compiler cannot know that a negative return value > from fwnode_property_read_u32_array() or acpi_gpiochip_pin_to_gpio_offset() > implies that the IS_ERR(gpio_desc) is true, as the value could in theory > be below -MAX_ERRNO. > > The function already initializes its output values to zero, and moving > that intialization a little higher up ensures that we can never have > uninitialized data in the caller. > > Fixes: c80f1ba75df2 ("ACPI / gpio: Add hogging support") > Signed-off-by: Arnd Bergmann Patch applied with Mika's ACK. Yours, Linus Walleij