phy: qcom-snps: Use dev_err_probe() to simplify code

[ Upstream commit 668dc8afce ]

In the probe path, dev_err() can be replaced with dev_err_probe()
which will check if error code is -EPROBE_DEFER and prints the
error name. It also sets the defer probe reason which can be
checked later through debugfs.

Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Link: https://lore.kernel.org/r/20220922111228.36355-8-yuancan@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Stable-dep-of: 8a0eb8f9b9 ("phy: qcom-snps-femto-v2: properly enable ref clock")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Yuan Can 2022-09-22 11:12:28 +00:00 коммит произвёл Greg Kroah-Hartman
Родитель d6f9258281
Коммит 450ef59bef
1 изменённых файлов: 6 добавлений и 12 удалений

Просмотреть файл

@ -304,12 +304,9 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev)
return PTR_ERR(hsphy->base); return PTR_ERR(hsphy->base);
hsphy->ref_clk = devm_clk_get(dev, "ref"); hsphy->ref_clk = devm_clk_get(dev, "ref");
if (IS_ERR(hsphy->ref_clk)) { if (IS_ERR(hsphy->ref_clk))
ret = PTR_ERR(hsphy->ref_clk); return dev_err_probe(dev, PTR_ERR(hsphy->ref_clk),
if (ret != -EPROBE_DEFER) "failed to get ref clk\n");
dev_err(dev, "failed to get ref clk, %d\n", ret);
return ret;
}
hsphy->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, NULL); hsphy->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, NULL);
if (IS_ERR(hsphy->phy_reset)) { if (IS_ERR(hsphy->phy_reset)) {
@ -322,12 +319,9 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev)
hsphy->vregs[i].supply = qcom_snps_hsphy_vreg_names[i]; hsphy->vregs[i].supply = qcom_snps_hsphy_vreg_names[i];
ret = devm_regulator_bulk_get(dev, num, hsphy->vregs); ret = devm_regulator_bulk_get(dev, num, hsphy->vregs);
if (ret) { if (ret)
if (ret != -EPROBE_DEFER) return dev_err_probe(dev, ret,
dev_err(dev, "failed to get regulator supplies: %d\n", "failed to get regulator supplies\n");
ret);
return ret;
}
pm_runtime_set_active(dev); pm_runtime_set_active(dev);
pm_runtime_enable(dev); pm_runtime_enable(dev);