All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Sumeet Pawnikar <sumeet4linux@gmail.com>
Cc: wens@kernel.org, t.schramm@manjaro.org, linux-pm@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] power: supply: Use dev_err_probe() for probe errors
Date: Sat, 5 Dec 2026 18:12:49 +0100	[thread overview]
Message-ID: <axRFQCXwMb_ljvny@venus> (raw)
In-Reply-To: <20261205152626.720455-1-sumeet4linux@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

Hi,

On Sat, Dec 05, 2026 at 08:56:26PM +0530, Sumeet Pawnikar wrote:
> Use dev_err_probe() when registering the power supply in the
> AXP20x battery driver and when initializing the CW2015 regmap.
> 
> This preserves the returned error while avoiding printing a raw
> error pointer with %ld and handles deferred probing consistently.
> 
> Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com>
> ---
>  drivers/power/supply/axp20x_battery.c | 8 +++-----
>  drivers/power/supply/cw2015_battery.c | 8 +++-----
>  2 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/power/supply/cw2015_battery.c b/drivers/power/supply/cw2015_battery.c
> index 9fab56756dcf..f618c76cc55c 100644
> --- a/drivers/power/supply/cw2015_battery.c
> +++ b/drivers/power/supply/cw2015_battery.c
> @@ -657,11 +657,9 @@ static int cw_bat_probe(struct i2c_client *client)
>  	}
>  
>  	cw_bat->regmap = devm_regmap_init_i2c(client, &cw2015_regmap_config);
> -	if (IS_ERR(cw_bat->regmap)) {
> -		dev_err(cw_bat->dev, "Failed to allocate regmap: %ld\n",
> -			PTR_ERR(cw_bat->regmap));
> -		return PTR_ERR(cw_bat->regmap);
> -	}
> +	if (IS_ERR(cw_bat->regmap))
> +		return dev_err_probe(cw_bat->dev, PTR_ERR(cw_bat->regmap),
> +				     "Failed to allocate regmap\n");

-ENOMEM shouldn't print anything, just drop this error message. Also
split this into two patches.

Greetings,

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2026-12-05 17:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 15:26 [PATCH] power: supply: Use dev_err_probe() for probe errors Sumeet Pawnikar
2026-12-05 17:12 ` Sebastian Reichel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=axRFQCXwMb_ljvny@venus \
    --to=sebastian.reichel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sumeet4linux@gmail.com \
    --cc=t.schramm@manjaro.org \
    --cc=wens@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.