2023-05-10 18:16:57

by Lorenz Brun

[permalink] [raw]
Subject: [PATCH v2 net-next] net: ethernet: mtk_eth_soc: log clock enable errors

Currently errors in clk_prepare_enable are silently swallowed.
Add a log stating which clock failed to be enabled and what the error
code was.

Signed-off-by: Lorenz Brun <[email protected]>
---
v2: reflowed long line
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index e14050e17862..ced12e5b7b32 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -3445,8 +3445,11 @@ static int mtk_clk_enable(struct mtk_eth *eth)

for (clk = 0; clk < MTK_CLK_MAX ; clk++) {
ret = clk_prepare_enable(eth->clks[clk]);
- if (ret)
+ if (ret) {
+ dev_err(eth->dev, "enabling clock %s failed with error %d\n",
+ mtk_clks_source_name[clk], ret);
goto err_disable_clks;
+ }
}

return 0;
--
2.39.2



2023-05-12 01:50:52

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH v2 net-next] net: ethernet: mtk_eth_soc: log clock enable errors

On Wed, 10 May 2023 20:13:50 +0200 Lorenz Brun wrote:
> for (clk = 0; clk < MTK_CLK_MAX ; clk++) {
> ret = clk_prepare_enable(eth->clks[clk]);
> - if (ret)
> + if (ret) {
> + dev_err(eth->dev, "enabling clock %s failed with error %d\n",
> + mtk_clks_source_name[clk], ret);
> goto err_disable_clks;
> + }

dev_err_probe() would be even better, I think?
--
pw-bot: cr