[PATCHv3 13/14] power: supply: generic-adc-battery: improve error message

Sebastian Reichel posted 14 patches 2 years, 11 months ago
[PATCHv3 13/14] power: supply: generic-adc-battery: improve error message
Posted by Sebastian Reichel 2 years, 11 months ago
Add device context and error code to the error messages to make it
useful.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/power/supply/generic-adc-battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/generic-adc-battery.c b/drivers/power/supply/generic-adc-battery.c
index df1c0a1c6b52..2fa946c93fb4 100644
--- a/drivers/power/supply/generic-adc-battery.c
+++ b/drivers/power/supply/generic-adc-battery.c
@@ -92,7 +92,7 @@ static int read_channel(struct gab *adc_bat, enum gab_chan_type channel,
 
 	ret = iio_read_channel_processed(adc_bat->channel[channel], result);
 	if (ret < 0)
-		pr_err("read channel error\n");
+		dev_err(&adc_bat->psy->dev, "read channel error: %d\n", ret);
 	else
 		*result *= 1000;
 
-- 
2.39.2
Re: [PATCHv3 13/14] power: supply: generic-adc-battery: improve error message
Posted by Matti Vaittinen 2 years, 10 months ago
On 3/18/23 00:57, Sebastian Reichel wrote:
> Add device context and error code to the error messages to make it
> useful.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>

> ---
>   drivers/power/supply/generic-adc-battery.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/generic-adc-battery.c b/drivers/power/supply/generic-adc-battery.c
> index df1c0a1c6b52..2fa946c93fb4 100644
> --- a/drivers/power/supply/generic-adc-battery.c
> +++ b/drivers/power/supply/generic-adc-battery.c
> @@ -92,7 +92,7 @@ static int read_channel(struct gab *adc_bat, enum gab_chan_type channel,
>   
>   	ret = iio_read_channel_processed(adc_bat->channel[channel], result);
>   	if (ret < 0)
> -		pr_err("read channel error\n");
> +		dev_err(&adc_bat->psy->dev, "read channel error: %d\n", ret);
>   	else
>   		*result *= 1000;
>   

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~
Re: [PATCHv3 13/14] power: supply: generic-adc-battery: improve error message
Posted by Linus Walleij 2 years, 10 months ago
On Fri, Mar 17, 2023 at 11:57 PM Sebastian Reichel <sre@kernel.org> wrote:

> Add device context and error code to the error messages to make it
> useful.
>
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij