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 message includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20230808012954.1643834-2-liaochang1@huawei.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
This commit is contained in:
Liao Chang 2023-08-08 09:29:46 +08:00 committed by Andi Shyti
parent 0c89b3257b
commit 7aec2f39a1

View File

@ -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); i2c_dev->bus_clk = bcm2835_i2c_register_div(&pdev->dev, mclk, i2c_dev);
if (IS_ERR(i2c_dev->bus_clk)) { if (IS_ERR(i2c_dev->bus_clk))
dev_err(&pdev->dev, "Could not register clock\n"); return dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->bus_clk),
return PTR_ERR(i2c_dev->bus_clk); "Could not register clock\n");
}
ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency",
&bus_clk_rate); &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); ret = clk_set_rate_exclusive(i2c_dev->bus_clk, bus_clk_rate);
if (ret < 0) { if (ret < 0)
dev_err(&pdev->dev, "Could not set clock frequency\n"); return dev_err_probe(&pdev->dev, ret,
return ret; "Could not set clock frequency\n");
}
ret = clk_prepare_enable(i2c_dev->bus_clk); ret = clk_prepare_enable(i2c_dev->bus_clk);
if (ret) { if (ret) {