diff mbox series

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

Message ID 20230317225707.1552512-14-sre@kernel.org
State Accepted
Commit 4fc1befb3a30d76a3f4b19833d45fb81ab1652b1
Headers show
Series Add DT support for generic ADC battery | expand

Commit Message

Sebastian Reichel March 17, 2023, 10:57 p.m. UTC
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(-)

Comments

Linus Walleij March 19, 2023, 9:13 p.m. UTC | #1
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
Matti Vaittinen March 21, 2023, 9:18 a.m. UTC | #2
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;
>
diff mbox series

Patch

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;