From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbcKHOM6 (ORCPT ); Tue, 8 Nov 2016 09:12:58 -0500 Received: from mga02.intel.com ([134.134.136.20]:35808 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbcKHOM5 (ORCPT ); Tue, 8 Nov 2016 09:12:57 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,462,1473145200"; d="scan'208";a="1201781" Date: Tue, 8 Nov 2016 16:12:48 +0200 From: Mika Westerberg To: Arnd Bergmann Cc: Linus Walleij , Alexandre Courbot , "Rafael J. Wysocki" , Dmitry Torokhov , Wei Yongjun , Christophe Ricard , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ACPI / gpio: avoid warning for gpio hogging code Message-ID: <20161108141248.GA1447@lahna.fi.intel.com> References: <20161108134035.1764500-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161108134035.1764500-1-arnd@arndb.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 08, 2016 at 02:40:06PM +0100, 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 Acked-by: Mika Westerberg