mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <ukleinek@debian.org>
To: Sebastian Reichel <sre@kernel.org>, Chen-Yu Tsai <wens@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] power: supply: axp20x_usb: Improve probe error reporting
Date: Mon, 21 Sep 2026 11:41:49 +0200	[thread overview]
Message-ID: <b699f8251afed736af454a981630926e45eb7da7.1789983244.git.ukleinek@debian.org> (raw)
In-Reply-To: <cover.1789983244.git.ukleinek@debian.org>

Don't be silent about probe fail issues. Just having axp20x-usb-power-supply
in /sys/kernel/debug/devices_deferred without a reason is making it harder
than necessary to debug the actual issue. So be a bit more cooperative and
add an error message for the typical failure points.

Exit paths where the error is -ENOMEM and register write failures are
skipped, these should be quite obvious even without a dedicated error
message.

Signed-off-by: Uwe Kleine-König <ukleinek@debian.org>
---
 drivers/power/supply/axp20x_usb_power.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 7ee3ec49d695..7625366104bc 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -925,10 +925,8 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 	const struct axp_data *axp_data;
 	int i, irq, ret;
 
-	if (!axp20x) {
-		dev_err(dev, "Parent drvdata not set\n");
-		return -EINVAL;
-	}
+	if (!axp20x)
+		return dev_err_probe(dev, -EINVAL, "Parent drvdata not set\n");
 
 	axp_data = of_device_get_match_data(dev);
 
@@ -998,7 +996,9 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 			ret = axp_data->axp20x_cfg_adc_reg(power);
 
 		if (ret)
-			return ret;
+			return dev_err_probe(dev, ret,
+					     "Failed to initialize for %s usage\n",
+					     IS_ENABLED(CONFIG_AXP20X_ADC) ? "iio" : "adc");
 	}
 
 	if (power->usb_bc_en_bit) {
@@ -1015,12 +1015,14 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 						   axp_data->power_desc,
 						   &psy_cfg);
 	if (IS_ERR(power->supply))
-		return PTR_ERR(power->supply);
+		return dev_err_probe(dev, PTR_ERR(power->supply),
+				     "Failed to register power supply\n");
 
 	/* Request irqs after registering, as irqs may trigger immediately */
 	for (i = 0; i < axp_data->num_irq_names; i++) {
 		irq = platform_get_irq_byname(pdev, axp_data->irq_names[i]);
 		if (irq < 0)
+			/* platform_get_irq_byname() already produced an error message */
 			return irq;
 
 		power->irqs[i] = regmap_irq_get_virq(axp20x->regmap_irqc, irq);
@@ -1028,6 +1030,7 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 						   axp20x_usb_power_irq, 0,
 						   DRVNAME, power);
 		if (ret < 0)
+			/* devm_request_any_context_irq() already produced an error message */
 			return ret;
 	}
 
-- 
2.47.3


  parent reply	other threads:[~2026-09-21 10:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  9:41 [PATCH 0/4] Drive-by changes to axp20x drivers Uwe Kleine-König
2026-09-21  9:41 ` [PATCH 1/4] pinctrl: axp209: Drop check for disabled devices Uwe Kleine-König
2026-10-01  6:52   ` Linus Walleij
2026-09-21  9:41 ` [PATCH 2/4] power: supply: axp20x*: " Uwe Kleine-König
2026-09-21  9:41 ` [PATCH 3/4] power: supply: axp20x_usb: Introduce a helper variable for &pdev->dev Uwe Kleine-König
2026-09-21  9:41 ` Uwe Kleine-König [this message]
2026-09-21 13:09 ` [PATCH 0/4] Drive-by changes to axp20x drivers Chen-Yu Tsai
2026-10-04 17:46 ` (subset) " 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=b699f8251afed736af454a981630926e45eb7da7.1789983244.git.ukleinek@debian.org \
    --to=ukleinek@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®