[PATCH 2/2] power: generic-adc-battery: return meaningful error when no channel available

Heiko Stübner
2014-05-16T13:10:51Z

From: Heiko Stuebner <heiko.stuebner@bq.com>

When no channel was found the driver currently always returns -ENODEV. This
hides the actual error which is available in ret from the kernel and disables
for example -EPROBE_DEFER handling.

Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
---
drivers/power/generic-adc-battery.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c
index 540d57f..02f434b 100644
--- a/drivers/power/generic-adc-battery.c
+++ b/drivers/power/generic-adc-battery.c
@@ -297,10 +297,8 @@ static int gab_probe(struct platform_device *pdev)
}

/* none of the channels are supported so let's bail out */
- if (index == 0) {
- ret = -ENODEV;
+ if (index == 0)
return ret;
- }

/*
* Total number of properties is equal to static properties
--
1.9.0