[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240830110421.62980-1-shenlichuan@vivo.com>
Date: Fri, 30 Aug 2024 19:04:21 +0800
From: Shen Lichuan <shenlichuan@...o.com>
To: ulf.hansson@...aro.org,
florian.fainelli@...adcom.com,
rjui@...adcom.com,
sbranden@...adcom.com
Cc: bcm-kernel-feedback-list@...adcom.com,
linux-pm@...r.kernel.org,
linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
opensource.kernel@...o.com,
Shen Lichuan <shenlichuan@...o.com>
Subject: [PATCH v1] pmdomain: bcm: Simplify with dev_err_probe()
Use dev_err_probe() to simplify the error path and unify a message
template.
Using this helper is totally fine even if err is known to never
be -EPROBE_DEFER.
The benefit compared to a normal dev_err() is the standardized format
of the error code, it being emitted symbolically and the fact that
the error code is returned which allows more compact error paths.
Signed-off-by: Shen Lichuan <shenlichuan@...o.com>
---
drivers/pmdomain/bcm/bcm2835-power.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/pmdomain/bcm/bcm2835-power.c b/drivers/pmdomain/bcm/bcm2835-power.c
index d2f0233cb620..be07ab8a663c 100644
--- a/drivers/pmdomain/bcm/bcm2835-power.c
+++ b/drivers/pmdomain/bcm/bcm2835-power.c
@@ -643,18 +643,16 @@ static int bcm2835_power_probe(struct platform_device *pdev)
power->rpivid_asb = pm->rpivid_asb;
id = readl(power->asb + ASB_AXI_BRDG_ID);
- if (id != BCM2835_BRDG_ID /* "BRDG" */) {
- dev_err(dev, "ASB register ID returned 0x%08x\n", id);
- return -ENODEV;
- }
+ if (id != BCM2835_BRDG_ID /* "BRDG" */)
+ return dev_err_probe(dev, -ENODEV,
+ "ASB register ID returned 0x%08x\n", id);
if (power->rpivid_asb) {
id = readl(power->rpivid_asb + ASB_AXI_BRDG_ID);
- if (id != BCM2835_BRDG_ID /* "BRDG" */) {
- dev_err(dev, "RPiVid ASB register ID returned 0x%08x\n",
- id);
- return -ENODEV;
- }
+ if (id != BCM2835_BRDG_ID /* "BRDG" */)
+ return dev_err_probe(dev, -ENODEV,
+ "RPiVid ASB register ID returned 0x%08x\n",
+ id);
}
power->pd_xlate.domains = devm_kcalloc(dev,
--
2.17.1
Powered by blists - more mailing lists