Message ID | 20240909122921.12627-3-zhangzekun11@huawei.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | Simplify code with dev_err_probe() | expand |
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 --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");
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(-)