2013-03-11 20:44:22

by Arnd Bergmann

[permalink] [raw]
Subject: Regulator API ignored return values

Hi all,

Mark Brown has added a patch to Linux-next that warns about certain regulator
API functions being called without checking the results, which seems to have
uncovered a number of bugs.

I've added a few people to Cc that might be interested in the reports and
in fixing these bugs. Below you can find a list of all instances I found
building the ARM defconfigs.

Arnd

==> build/dove_defconfig/faillog <==
/git/arm-soc/drivers/mmc/host/sdhci.c: In function 'sdhci_add_host':
/git/arm-soc/drivers/mmc/host/sdhci.c:2910:19: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]

==> build/imx_v4_v5_defconfig/faillog <==
/git/arm-soc/drivers/input/touchscreen/ads7846.c: In function '__ads7846_enable':
/git/arm-soc/drivers/input/touchscreen/ads7846.c:239:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
/git/arm-soc/drivers/mmc/host/sdhci.c: In function 'sdhci_add_host':
/git/arm-soc/drivers/mmc/host/sdhci.c:2910:19: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
/git/arm-soc/drivers/video/backlight/l4f00242t03.c: In function 'l4f00242t03_lcd_init':
/git/arm-soc/drivers/video/backlight/l4f00242t03.c:58:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
/git/arm-soc/drivers/video/backlight/l4f00242t03.c:61:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]

==> build/imx_v6_v7_defconfig/faillog <==
/git/arm-soc/drivers/mmc/host/sdhci.c: In function 'sdhci_add_host':
/git/arm-soc/drivers/mmc/host/sdhci.c:2910:19: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
/git/arm-soc/drivers/video/backlight/l4f00242t03.c: In function 'l4f00242t03_lcd_init':
/git/arm-soc/drivers/video/backlight/l4f00242t03.c:58:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
/git/arm-soc/drivers/video/backlight/l4f00242t03.c:61:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]

==> build/magician_defconfig/faillog <==
/git/arm-soc/drivers/usb/otg/gpio_vbus.c: In function 'set_vbus_draw':
/git/arm-soc/drivers/usb/otg/gpio_vbus.c:72:20: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]

==> build/mmp2_defconfig/faillog <==
/git/arm-soc/drivers/mmc/host/sdhci.c: In function 'sdhci_add_host':
/git/arm-soc/drivers/mmc/host/sdhci.c:2910:19: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]

==> build/omap2plus_defconfig/faillog <==
/git/arm-soc/drivers/input/touchscreen/ads7846.c: In function '__ads7846_enable':
/git/arm-soc/drivers/input/touchscreen/ads7846.c:239:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]

==> build/tegra_defconfig/faillog <==
/git/arm-soc/arch/arm/mach-tegra/board-harmony-pcie.c: In function 'harmony_pcie_init':
/git/arm-soc/arch/arm/mach-tegra/board-harmony-pcie.c:65:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
/git/arm-soc/drivers/mmc/host/sdhci.c: In function 'sdhci_add_host':
/git/arm-soc/drivers/mmc/host/sdhci.c:2910:19: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]

==> build/u8500_defconfig/faillog <==
/git/arm-soc/arch/arm/mach-ux500/board-mop500.c: In function 'mop500_prox_activate':
/git/arm-soc/arch/arm/mach-ux500/board-mop500.c:432:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
/git/arm-soc/drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_runtime_resume':
/git/arm-soc/drivers/mfd/ab8500-gpadc.c:598:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
/git/arm-soc/drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_probe':
/git/arm-soc/drivers/mfd/ab8500-gpadc.c:655:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
/git/arm-soc/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c: In function 'synaptics_rmi4_resume':
/git/arm-soc/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:1085:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]


2013-03-11 20:48:24

by Stephen Warren

[permalink] [raw]
Subject: Re: Regulator API ignored return values

On 03/11/2013 02:43 PM, Arnd Bergmann wrote:
> Hi all,
>
> Mark Brown has added a patch to Linux-next that warns about certain regulator
> API functions being called without checking the results, which seems to have
> uncovered a number of bugs.
>
> I've added a few people to Cc that might be interested in the reports and
> in fixing these bugs. Below you can find a list of all instances I found
> building the ARM defconfigs.

> ==> build/tegra_defconfig/faillog <==
> /git/arm-soc/arch/arm/mach-tegra/board-harmony-pcie.c: In function 'harmony_pcie_init':
> /git/arm-soc/arch/arm/mach-tegra/board-harmony-pcie.c:65:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]

This one should be fixed by 84b808d "ARM: tegra: fix ignored return
value of regulator_enable" the next time next is rebuilt.

2013-03-11 21:55:58

by Chris Ball

[permalink] [raw]
Subject: Re: Regulator API ignored return values

Hi,

On Mon, Mar 11 2013, Arnd Bergmann wrote:
> ==> build/dove_defconfig/faillog <==
> /git/arm-soc/drivers/mmc/host/sdhci.c: In function 'sdhci_add_host':
> /git/arm-soc/drivers/mmc/host/sdhci.c:2910:19: warning: ignoring
> return value of 'regulator_enable', declared with attribute
> warn_unused_result [-Wunused-result]

Thanks, this looks like the right fix to me:


Subject: [PATCH] mmc: sdhci: Don't ignore regulator_enable() return value

Fixes:
/git/arm-soc/drivers/mmc/host/sdhci.c: In function 'sdhci_add_host':
/git/arm-soc/drivers/mmc/host/sdhci.c:2910:19: warning: ignoring
return value of 'regulator_enable', declared with attribute
warn_unused_result [-Wunused-result]

Reported-by: Arnd Bergmann <[email protected]>
Signed-off-by: Chris Ball <[email protected]>
---
drivers/mmc/host/sdhci.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 51bbba4..fbf0b93 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2907,12 +2907,17 @@ int sdhci_add_host(struct sdhci_host *host)
host->vqmmc = NULL;
}
} else {
- regulator_enable(host->vqmmc);
+ ret = regulator_enable(host->vqmmc);
if (!regulator_is_supported_voltage(host->vqmmc, 1700000,
1950000))
caps[1] &= ~(SDHCI_SUPPORT_SDR104 |
SDHCI_SUPPORT_SDR50 |
SDHCI_SUPPORT_DDR50);
+ if (ret) {
+ pr_warn("%s: Failed to enable vqmmc regulator: %d\n",
+ mmc_hostname(mmc), ret);
+ host->vqmmc = NULL;
+ }
}

if (host->quirks2 & SDHCI_QUIRK2_NO_1_8_V)
--
Chris Ball <[email protected]> <http://printf.net/>
One Laptop Per Child

2013-03-12 05:11:55

by Jingoo Han

[permalink] [raw]
Subject: Re: Regulator API ignored return values

On Tuesday, March 12, 2013 5:44 AM, Arnd Bergmann wrote:
>
> Hi all,
>
> Mark Brown has added a patch to Linux-next that warns about certain regulator
> API functions being called without checking the results, which seems to have
> uncovered a number of bugs.
>
> I've added a few people to Cc that might be interested in the reports and
> in fixing these bugs. Below you can find a list of all instances I found
> building the ARM defconfigs.
>
> Arnd
>
[...]
> /git/arm-soc/drivers/video/backlight/l4f00242t03.c: In function 'l4f00242t03_lcd_init':
> /git/arm-soc/drivers/video/backlight/l4f00242t03.c:58:18: warning: ignoring return value of
> 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
> /git/arm-soc/drivers/video/backlight/l4f00242t03.c:61:18: warning: ignoring return value of
> 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]

Hi Arnd Bergmann,

I fixed these warnings and the patch was added to mm-tree.
(http://www.spinics.net/lists/mm-commits/msg95324.html)
Thank you for reporting :)

Best regards,
Jingoo Han
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2013-03-12 18:22:24

by Mark Brown

[permalink] [raw]
Subject: Re: Regulator API ignored return values

On Mon, Mar 11, 2013 at 08:43:53PM +0000, Arnd Bergmann wrote:

> /git/arm-soc/drivers/input/touchscreen/ads7846.c: In function '__ads7846_enable':
> /git/arm-soc/drivers/video/backlight/l4f00242t03.c: In function 'l4f00242t03_lcd_init':

In sent patches for these ones (and a few others) already.


Attachments:
(No filename) (298.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments