Re: [PATCH 16/28] pcmcia: fix return value of soc_pcmcia_regulator_set
On Tue, Oct 18, 2016 at 12:13:37AM +0200, Arnd Bergmann wrote: > The newly introduced soc_pcmcia_regulator_set() function sometimes returns > without setting its return code, as shown by this warning: > > drivers/pcmcia/soc_common.c: In function 'soc_pcmcia_regulator_set': > drivers/pcmcia/soc_common.c:112:5: error: 'ret' may be used uninitialized in > this function [-Werror=maybe-uninitialized] > > This changes it to propagate the regulator_disable() result instead. I guess this is the problem with the stupid patch which silences this warning - I don't see this warning here. Having this warning disabled means that _real_ coding errors end up making their way into the kernel (yes, this should be an error, this is not a warning, because the value of 'ret' is completely undefined, and therefore the behaviour of the following code is undefined.) With the warning silenced, it means that such errors are undetectable. I knew nothing about this until I received this patch, and I always check that the code I send is warning-free on the GCC I'm using. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Re: [PATCH 16/28] pcmcia: fix return value of soc_pcmcia_regulator_set
On Tue, Oct 18, 2016 at 12:13:37AM +0200, Arnd Bergmann wrote: > The newly introduced soc_pcmcia_regulator_set() function sometimes returns > without setting its return code, as shown by this warning: > > drivers/pcmcia/soc_common.c: In function 'soc_pcmcia_regulator_set': > drivers/pcmcia/soc_common.c:112:5: error: 'ret' may be used uninitialized in > this function [-Werror=maybe-uninitialized] > > This changes it to propagate the regulator_disable() result instead. I guess this is the problem with the stupid patch which silences this warning - I don't see this warning here. Having this warning disabled means that _real_ coding errors end up making their way into the kernel (yes, this should be an error, this is not a warning, because the value of 'ret' is completely undefined, and therefore the behaviour of the following code is undefined.) With the warning silenced, it means that such errors are undetectable. I knew nothing about this until I received this patch, and I always check that the code I send is warning-free on the GCC I'm using. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
[PATCH 16/28] pcmcia: fix return value of soc_pcmcia_regulator_set
The newly introduced soc_pcmcia_regulator_set() function sometimes returns without setting its return code, as shown by this warning: drivers/pcmcia/soc_common.c: In function 'soc_pcmcia_regulator_set': drivers/pcmcia/soc_common.c:112:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes it to propagate the regulator_disable() result instead. Fixes: ac61b6001a63 ("pcmcia: soc_common: add support for Vcc and Vpp regulators") Cc: Russell KingSigned-off-by: Arnd Bergmann --- drivers/pcmcia/soc_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 153f312..b6b316d 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -107,7 +107,7 @@ int soc_pcmcia_regulator_set(struct soc_pcmcia_socket *skt, ret = regulator_enable(r->reg); } else { - regulator_disable(r->reg); + ret = regulator_disable(r->reg); } if (ret == 0) r->on = on; -- 2.9.0
[PATCH 16/28] pcmcia: fix return value of soc_pcmcia_regulator_set
The newly introduced soc_pcmcia_regulator_set() function sometimes returns without setting its return code, as shown by this warning: drivers/pcmcia/soc_common.c: In function 'soc_pcmcia_regulator_set': drivers/pcmcia/soc_common.c:112:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes it to propagate the regulator_disable() result instead. Fixes: ac61b6001a63 ("pcmcia: soc_common: add support for Vcc and Vpp regulators") Cc: Russell King Signed-off-by: Arnd Bergmann --- drivers/pcmcia/soc_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 153f312..b6b316d 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -107,7 +107,7 @@ int soc_pcmcia_regulator_set(struct soc_pcmcia_socket *skt, ret = regulator_enable(r->reg); } else { - regulator_disable(r->reg); + ret = regulator_disable(r->reg); } if (ret == 0) r->on = on; -- 2.9.0