Commit 5aa4733b authored by Thomas Richard's avatar Thomas Richard Committed by Vinod Koul

phy: ti: phy-j721e-wiz: use dev_err_probe() instead of dev_err()

Use dev_err_probe() instead of dev_err() in wiz_clock_init() to simplify
the code and standardize the error output.
Signed-off-by: default avatarThomas Richard <thomas.richard@bootlin.com>
Link: https://lore.kernel.org/r/20240412-j7200-phy-s2r-v1-1-f15815833974@bootlin.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 7d5ebb62
...@@ -1088,11 +1088,10 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) ...@@ -1088,11 +1088,10 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node)
int i; int i;
clk = devm_clk_get(dev, "core_ref_clk"); clk = devm_clk_get(dev, "core_ref_clk");
if (IS_ERR(clk)) { if (IS_ERR(clk))
dev_err(dev, "core_ref_clk clock not found\n"); return dev_err_probe(dev, PTR_ERR(clk),
ret = PTR_ERR(clk); "core_ref_clk clock not found\n");
return ret;
}
wiz->input_clks[WIZ_CORE_REFCLK] = clk; wiz->input_clks[WIZ_CORE_REFCLK] = clk;
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
...@@ -1122,11 +1121,10 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) ...@@ -1122,11 +1121,10 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node)
if (wiz->data->pma_cmn_refclk1_int_mode) { if (wiz->data->pma_cmn_refclk1_int_mode) {
clk = devm_clk_get(dev, "core_ref1_clk"); clk = devm_clk_get(dev, "core_ref1_clk");
if (IS_ERR(clk)) { if (IS_ERR(clk))
dev_err(dev, "core_ref1_clk clock not found\n"); return dev_err_probe(dev, PTR_ERR(clk),
ret = PTR_ERR(clk); "core_ref1_clk clock not found\n");
return ret;
}
wiz->input_clks[WIZ_CORE_REFCLK1] = clk; wiz->input_clks[WIZ_CORE_REFCLK1] = clk;
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
...@@ -1137,11 +1135,10 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) ...@@ -1137,11 +1135,10 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node)
} }
clk = devm_clk_get(dev, "ext_ref_clk"); clk = devm_clk_get(dev, "ext_ref_clk");
if (IS_ERR(clk)) { if (IS_ERR(clk))
dev_err(dev, "ext_ref_clk clock not found\n"); return dev_err_probe(dev, PTR_ERR(clk),
ret = PTR_ERR(clk); "ext_ref_clk clock not found\n");
return ret;
}
wiz->input_clks[WIZ_EXT_REFCLK] = clk; wiz->input_clks[WIZ_EXT_REFCLK] = clk;
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
...@@ -1157,8 +1154,9 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) ...@@ -1157,8 +1154,9 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node)
case J721S2_WIZ_10G: case J721S2_WIZ_10G:
ret = wiz_clock_register(wiz); ret = wiz_clock_register(wiz);
if (ret) if (ret)
dev_err(dev, "Failed to register wiz clocks\n"); return dev_err_probe(dev, ret, "Failed to register wiz clocks\n");
return ret;
return 0;
default: default:
break; break;
} }
...@@ -1167,15 +1165,14 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) ...@@ -1167,15 +1165,14 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node)
node_name = clk_mux_sel[i].node_name; node_name = clk_mux_sel[i].node_name;
clk_node = of_get_child_by_name(node, node_name); clk_node = of_get_child_by_name(node, node_name);
if (!clk_node) { if (!clk_node) {
dev_err(dev, "Unable to get %s node\n", node_name); ret = dev_err_probe(dev, -EINVAL, "Unable to get %s node\n", node_name);
ret = -EINVAL;
goto err; goto err;
} }
ret = wiz_mux_of_clk_register(wiz, clk_node, wiz->mux_sel_field[i], ret = wiz_mux_of_clk_register(wiz, clk_node, wiz->mux_sel_field[i],
clk_mux_sel[i].table); clk_mux_sel[i].table);
if (ret) { if (ret) {
dev_err(dev, "Failed to register %s clock\n", dev_err_probe(dev, ret, "Failed to register %s clock\n",
node_name); node_name);
of_node_put(clk_node); of_node_put(clk_node);
goto err; goto err;
...@@ -1188,15 +1185,14 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) ...@@ -1188,15 +1185,14 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node)
node_name = clk_div_sel[i].node_name; node_name = clk_div_sel[i].node_name;
clk_node = of_get_child_by_name(node, node_name); clk_node = of_get_child_by_name(node, node_name);
if (!clk_node) { if (!clk_node) {
dev_err(dev, "Unable to get %s node\n", node_name); ret = dev_err_probe(dev, -EINVAL, "Unable to get %s node\n", node_name);
ret = -EINVAL;
goto err; goto err;
} }
ret = wiz_div_clk_register(wiz, clk_node, wiz->div_sel_field[i], ret = wiz_div_clk_register(wiz, clk_node, wiz->div_sel_field[i],
clk_div_sel[i].table); clk_div_sel[i].table);
if (ret) { if (ret) {
dev_err(dev, "Failed to register %s clock\n", dev_err_probe(dev, ret, "Failed to register %s clock\n",
node_name); node_name);
of_node_put(clk_node); of_node_put(clk_node);
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment