From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753832AbbIANKH (ORCPT ); Tue, 1 Sep 2015 09:10:07 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:47244 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752792AbbIANKF (ORCPT ); Tue, 1 Sep 2015 09:10:05 -0400 Date: Tue, 1 Sep 2015 14:09:55 +0100 From: Mark Brown To: Krzysztof Kozlowski Cc: Keith Busch , linux-kernel@vger.kernel.org, Liam Girdwood Message-ID: <20150901130955.GV5313@sirena.org.uk> References: <1441039312-2961-1-git-send-email-keith.busch@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bE2XbrxqIoa/xW9+" Content-Disposition: inline In-Reply-To: X-Cookie: Short people get rained on last. User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 94.175.94.161 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH] Regulator: Suppress compiler warnings X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --bE2XbrxqIoa/xW9+ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 01, 2015 at 09:52:13AM +0900, Krzysztof Kozlowski wrote: > 2015-09-01 1:41 GMT+09:00 Keith Busch : > > Some compilers complain of possible uninitialized variable usage, like > > the following: > > drivers/regulator/helpers.c: In function =E2=80=98regulator_get_bypas= s_regmap=E2=80=99: > > drivers/regulator/helpers.c:463:16: warning: =E2=80=98val=E2=80=99 ma= y be used uninitialized in this function [-Wuninitialized] > > The code is safe though, and only uses the variables if they were > > successfully set, so suppressing the warning with uninitialized_val. > > int regulator_is_enabled_regmap(struct regulator_dev *rdev) > > { > > - unsigned int val; > > + unsigned int uninitialized_var(val); > > int ret; > > > > ret =3D 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. --bE2XbrxqIoa/xW9+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJV5aOiAAoJECTWi3JdVIfQXv4H/2WoKlAdkTXZ9F+8RKhETMPg rm8AE2q5oYVf3QSljuDYDL3CX+4H9bGbN0aortg3UoqSZo0j0JBOQKEztK4yIYvZ UUPAmLqaKD0TmtpfdYLDAKMkpYpwDMMeIju8BJuY18c/oB7tdBfu5+Gc1XcFC7jX x7z0etADfvhhfJK/tlCVqDBHaMcld+bTd0muAoj3YbBaw8JWL++zQI8RnkuRsHh3 8wpzV9mzU2Ben2kmLEYfSzVMHawkFhpxJOJ9mcFRdWDXgzGO4mqPaCtKHM0g19+h 6w3d1UrwZYfhMv45DBW9HEmLSsnDJf0SSzncdK0LZBbfMLPDfuQgNaWOWk5+aMA= =VsxP -----END PGP SIGNATURE----- --bE2XbrxqIoa/xW9+--