From: Adeel Zahid <adeel.m.zahid@gmail.com>
To: Andi Shyti <andi.shyti@kernel.org>,
Chen-Yu Tsai <wens@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>
Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev,
Adeel Zahid <adeel.m.zahid@gmail.com>
Subject: [PATCH] i2c: p2wi: use dev_err_probe() for clock and reset errors
Date: Sat, 4 Apr 2026 22:40:21 -0500 [thread overview]
Message-ID: <20260405034021.12435-1-adeel.m.zahid@gmail.com> (raw)
Replace open-coded error logging and returns with dev_err_probe() when acquiring the clock and reset controller in probe.
This makes the error handling more concise and correctly handles deferred probe.
Signed-off-by: Adeel Zahid <adeel.m.zahid@gmail.com>
---
drivers/i2c/busses/i2c-sun6i-p2wi.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/i2c/busses/i2c-sun6i-p2wi.c b/drivers/i2c/busses/i2c-sun6i-p2wi.c
index fb5280b8cf7f..2be6d50273bd 100644
--- a/drivers/i2c/busses/i2c-sun6i-p2wi.c
+++ b/drivers/i2c/busses/i2c-sun6i-p2wi.c
@@ -245,20 +245,16 @@ static int p2wi_probe(struct platform_device *pdev)
return irq;
p2wi->clk = devm_clk_get_enabled(dev, NULL);
- if (IS_ERR(p2wi->clk)) {
- ret = PTR_ERR(p2wi->clk);
- dev_err(dev, "failed to enable clk: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(p2wi->clk))
+ return dev_err_probe(dev, PTR_ERR(p2wi->clk),
+ "failed to enable clk\n");
parent_clk_freq = clk_get_rate(p2wi->clk);
p2wi->rstc = devm_reset_control_get_exclusive(dev, NULL);
- if (IS_ERR(p2wi->rstc)) {
- dev_err(dev, "failed to retrieve reset controller: %pe\n",
- p2wi->rstc);
- return PTR_ERR(p2wi->rstc);
- }
+ if (IS_ERR(p2wi->rstc))
+ return dev_err_probe(dev, PTR_ERR(p2wi->rstc),
+ "failed to retrieve reset controller\n");
ret = reset_control_deassert(p2wi->rstc);
if (ret) {
--
2.43.0
reply other threads:[~2026-04-05 3:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260405034021.12435-1-adeel.m.zahid@gmail.com \
--to=adeel.m.zahid@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=samuel@sholland.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