All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matti Vaittinen <matti.vaittinen@linux.dev>
To: Matti Vaittinen <mazziesaccount@gmail.com>,
	Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Lee Jones <lee@kernel.org>, Sebastian Reichel <sre@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andreas Kemnade <andreas@kemnade.info>
Subject: [PATCH] power: supply: bd71828: Use dev_err_probe()
Date: Thu, 15 Jan 2026 12:19:04 +0200	[thread overview]
Message-ID: <aWi_GG74sZRfajA_@mva-rohm> (raw)

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

From: Matti Vaittinen <mazziesaccount@gmail.com>

The driver uses separate error printing and error returning at probe()
for locations where the error value is hard-coded and can't be
EPROBE_DEFER. This helps to omit the extra return value check which is
done in dev_err_probe().

Using the dev_err_probe() has some other benefits besides handling the
-EPROBE_DEFER though, like standardizing the print for error numbers.
Some believe thes outweigh the benefit of skipping the extra check.

Use dev_err_probe() consistently in the bd71828 power-supply probe.

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

This patch depends on, and is done on top of, the series:
https://lore.kernel.org/all/cover.1765804226.git.mazziesaccount@gmail.com/
as discussed:
https://lore.kernel.org/all/aWbg3PTf677Jt9rG@venus/

 drivers/power/supply/bd71828-power.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/power/supply/bd71828-power.c b/drivers/power/supply/bd71828-power.c
index 438e220a9cb7..0e00acb58993 100644
--- a/drivers/power/supply/bd71828-power.c
+++ b/drivers/power/supply/bd71828-power.c
@@ -1058,10 +1058,8 @@ static int bd71828_power_probe(struct platform_device *pdev)
 		pwr->regmap = dev_get_regmap(pdev->dev.parent, NULL);
 	else
 		pwr->regmap = dev_get_regmap(pdev->dev.parent, "wrap-map");
-	if (!pwr->regmap) {
-		dev_err(&pdev->dev, "No parent regmap\n");
-		return -EINVAL;
-	}
+	if (!pwr->regmap)
+		return dev_err_probe(&pdev->dev, -EINVAL, "No parent regmap\n");
 
 	pwr->dev = &pdev->dev;
 
@@ -1083,8 +1081,7 @@ static int bd71828_power_probe(struct platform_device *pdev)
 		dev_dbg(pwr->dev, "Found ROHM BD72720\n");
 		break;
 	default:
-		dev_err(pwr->dev, "Unknown PMIC\n");
-		return -EINVAL;
+		return dev_err_probe(pwr->dev, -EINVAL, "Unknown PMIC\n");
 	}
 
 	ret = bd7182x_get_rsens(pwr);
-- 
2.52.0


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

             reply	other threads:[~2026-01-15 10:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 10:19 Matti Vaittinen [this message]
2026-01-30 22:24 ` [PATCH] power: supply: bd71828: Use dev_err_probe() Sebastian Reichel

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=aWi_GG74sZRfajA_@mva-rohm \
    --to=matti.vaittinen@linux.dev \
    --cc=andreas@kemnade.info \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=sre@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.