[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240823035116.21590-5-rongqianfeng@vivo.com>
Date: Fri, 23 Aug 2024 11:51:16 +0800
From: Rong Qianfeng <rongqianfeng@...o.com>
To: biju.das.jz@...renesas.com,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Andi Shyti <andi.shyti@...nel.org>,
Paul Cercueil <paul@...pouillou.net>,
linux-renesas-soc@...r.kernel.org,
linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org
Cc: opensource.kernel@...o.com,
Rong Qianfeng <rongqianfeng@...o.com>
Subject: [PATCH v3 4/4] i2c: jz4780: Use dev_err_probe()
No more special handling needed here, so use dev_err_probe()
to simplify the code.
Signed-off-by: Rong Qianfeng <rongqianfeng@...o.com>
---
drivers/i2c/busses/i2c-jz4780.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
index f5362c5dfb50..0cb52a6d05b5 100644
--- a/drivers/i2c/busses/i2c-jz4780.c
+++ b/drivers/i2c/busses/i2c-jz4780.c
@@ -798,17 +798,15 @@ static int jz4780_i2c_probe(struct platform_device *pdev)
ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency",
&clk_freq);
- if (ret) {
- dev_err(&pdev->dev, "clock-frequency not specified in DT\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret,
+ "clock-frequency not specified in DT\n");
i2c->speed = clk_freq / 1000;
- if (i2c->speed == 0) {
- ret = -EINVAL;
- dev_err(&pdev->dev, "clock-frequency minimum is 1000\n");
- return ret;
- }
+ if (i2c->speed == 0)
+ return dev_err_probe(&pdev->dev, -EINVAL,
+ "clock-frequency minimum is 1000\n");
+
jz4780_i2c_set_speed(i2c);
dev_info(&pdev->dev, "Bus frequency is %d KHz\n", i2c->speed);
--
2.39.0
Powered by blists - more mailing lists