mirror of https://gitee.com/openkylin/linux.git
mmc: meson: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20200902193658.20539-6-krzk@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
295208a666
commit
89280d0963
|
@ -426,11 +426,9 @@ static int meson_mmc_clk_init(struct meson_host *host)
|
|||
|
||||
snprintf(name, sizeof(name), "clkin%d", i);
|
||||
clk = devm_clk_get(host->dev, name);
|
||||
if (IS_ERR(clk)) {
|
||||
if (clk != ERR_PTR(-EPROBE_DEFER))
|
||||
dev_err(host->dev, "Missing clock %s\n", name);
|
||||
return PTR_ERR(clk);
|
||||
}
|
||||
if (IS_ERR(clk))
|
||||
return dev_err_probe(host->dev, PTR_ERR(clk),
|
||||
"Missing clock %s\n", name);
|
||||
|
||||
mux_parent_names[i] = __clk_get_name(clk);
|
||||
}
|
||||
|
@ -1077,12 +1075,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
ret = device_reset_optional(&pdev->dev);
|
||||
if (ret) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(&pdev->dev, "device reset failed: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret, "device reset failed\n");
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
host->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
|
|
Loading…
Reference in New Issue