diff mbox series

[2/4] soc: aspeed: Simplify code with dev_err_probe()

Message ID 20240909122921.12627-3-zhangzekun11@huawei.com (mailing list archive)
State Not Applicable
Headers show
Series Simplify code with dev_err_probe() | expand

Commit Message

zhangzekun (A) Sept. 9, 2024, 12:29 p.m. UTC
Use dev_err_probe() directly in the driver probe phase, and we
don't need to judge if the error code is not equal to -EPROBE_DEFER.
This can simplify the code a bit.

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/soc/aspeed/aspeed-lpc-snoop.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Andrew Jeffery Sept. 12, 2024, 2:40 a.m. UTC | #1
On Mon, 2024-09-09 at 20:29 +0800, Zhang Zekun wrote:
> Use dev_err_probe() directly in the driver probe phase, and we
> don't need to judge if the error code is not equal to -EPROBE_DEFER.
> This can simplify the code a bit.
> 
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>

Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff mbox series

Patch

diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c
index 888b5840c015..33d9f8f2e662 100644
--- a/drivers/soc/aspeed/aspeed-lpc-snoop.c
+++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c
@@ -293,12 +293,10 @@  static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
 	}
 
 	lpc_snoop->clk = devm_clk_get(dev, NULL);
-	if (IS_ERR(lpc_snoop->clk)) {
-		rc = PTR_ERR(lpc_snoop->clk);
-		if (rc != -EPROBE_DEFER)
-			dev_err(dev, "couldn't get clock\n");
-		return rc;
-	}
+	if (IS_ERR(lpc_snoop->clk))
+		return dev_err_probe(dev, PTR_ERR(lpc_snoop->clk),
+				     "couldn't get clock\n");
+
 	rc = clk_prepare_enable(lpc_snoop->clk);
 	if (rc) {
 		dev_err(dev, "couldn't enable clock\n");