[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230802095737.3957587-2-liaochang1@huawei.com>
Date: Wed, 2 Aug 2023 17:57:29 +0800
From: Liao Chang <liaochang1@...wei.com>
To: <andi.shyti@...nel.org>, <florian.fainelli@...adcom.com>,
<bcm-kernel-feedback-list@...adcom.com>, <rjui@...adcom.com>,
<sbranden@...adcom.com>, <yangyicong@...ilicon.com>,
<aisheng.dong@....com>, <shawnguo@...nel.org>,
<s.hauer@...gutronix.de>, <kernel@...gutronix.de>,
<festevam@...il.com>, <linux-imx@....com>, <kblaiech@...dia.com>,
<asmaa@...dia.com>, <loic.poulain@...aro.org>, <rfoss@...nel.org>,
<ardb@...nel.org>, <gcherian@...vell.com>
CC: <linux-i2c@...r.kernel.org>,
<linux-rpi-kernel@...ts.infradead.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>
Subject: [PATCH 1/9] i2c: bcm2835: Use dev_err_probe in probe function
Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.
Reviewed-by: Florian Fainelli <florian.fainelli@...adcom.com>
Signed-off-by: Liao Chang <liaochang1@...wei.com>
---
drivers/i2c/busses/i2c-bcm2835.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 8ce6d3f49551..9af1a68269ab 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -430,10 +430,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
i2c_dev->bus_clk = bcm2835_i2c_register_div(&pdev->dev, mclk, i2c_dev);
- if (IS_ERR(i2c_dev->bus_clk)) {
- dev_err(&pdev->dev, "Could not register clock\n");
- return PTR_ERR(i2c_dev->bus_clk);
- }
+ if (IS_ERR(i2c_dev->bus_clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->bus_clk),
+ "Could not register clock\n");
ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency",
&bus_clk_rate);
@@ -444,10 +443,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
}
ret = clk_set_rate_exclusive(i2c_dev->bus_clk, bus_clk_rate);
- if (ret < 0) {
- dev_err(&pdev->dev, "Could not set clock frequency\n");
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret,
+ "Could not set clock frequency\n");
ret = clk_prepare_enable(i2c_dev->bus_clk);
if (ret) {
--
2.25.1
Powered by blists - more mailing lists