From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755495AbbIASkt (ORCPT ); Tue, 1 Sep 2015 14:40:49 -0400 Received: from mga03.intel.com ([134.134.136.65]:39066 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753082AbbIASks (ORCPT ); Tue, 1 Sep 2015 14:40:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,450,1437462000"; d="scan'208";a="636490604" Date: Tue, 1 Sep 2015 18:40:46 +0000 (UTC) From: Keith Busch X-X-Sender: vmware@localhost.lm.intel.com To: Mark Brown cc: Krzysztof Kozlowski , Keith Busch , linux-kernel@vger.kernel.org, Liam Girdwood Subject: Re: [PATCH] Regulator: Suppress compiler warnings In-Reply-To: <20150901130955.GV5313@sirena.org.uk> Message-ID: References: <1441039312-2961-1-git-send-email-keith.busch@intel.com> <20150901130955.GV5313@sirena.org.uk> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 1 Sep 2015, Mark Brown wrote: > On Tue, Sep 01, 2015 at 09:52:13AM +0900, Krzysztof Kozlowski wrote: >> 2015-09-01 1:41 GMT+09:00 Keith Busch : >>> int regulator_is_enabled_regmap(struct regulator_dev *rdev) >>> { >>> - unsigned int val; >>> + unsigned int uninitialized_var(val); >>> int ret; >>> >>> ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val); > >> This is quite common pattern so such work-around should be added to >> many other functions leading to code obfuscation. Which compiler do >> you have in mind? > > Right, plus this will shut up valid compiler warnings which is poor > practice anyway. I'd say this is a bug in the compiler. Using gcc 4.7.2 with '-Os'. The warning does not happen when that option is not used, i.e. disable CONFIG_CC_OPTIMIZE_FOR_SIZE. I will certainly try other gcc versions with the same config and see what happens.