[PATCH v3 4/4] i2c: jz4780: Use dev_err_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No more special handling needed here, so use dev_err_probe()
to simplify the code.

Signed-off-by: Rong Qianfeng <rongqianfeng@xxxxxxxx>
---
 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





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux