[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150901130955.GV5313@sirena.org.uk>
Date: Tue, 1 Sep 2015 14:09:55 +0100
From: Mark Brown <broonie@...nel.org>
To: Krzysztof Kozlowski <k.kozlowski@...sung.com>
Cc: Keith Busch <keith.busch@...el.com>, linux-kernel@...r.kernel.org,
Liam Girdwood <lgirdwood@...il.com>
Subject: Re: [PATCH] Regulator: Suppress compiler warnings
On Tue, Sep 01, 2015 at 09:52:13AM +0900, Krzysztof Kozlowski wrote:
> 2015-09-01 1:41 GMT+09:00 Keith Busch <keith.busch@...el.com>:
> > Some compilers complain of possible uninitialized variable usage, like
> > the following:
> > drivers/regulator/helpers.c: In function ‘regulator_get_bypass_regmap’:
> > drivers/regulator/helpers.c:463:16: warning: ‘val’ may 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 = 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.
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists