2020-11-13 06:34:19

by Zhang Changzhong

[permalink] [raw]
Subject: [PATCH net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe()

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 9efc9b2b04c7 ("net: stmmac: Add dwmac-intel-plat for GBE driver")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zhang Changzhong <[email protected]>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
index f61cb99..82b1c7a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
@@ -113,8 +113,10 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
/* Enable TX clock */
if (dwmac->data->tx_clk_en) {
dwmac->tx_clk = devm_clk_get(&pdev->dev, "tx_clk");
- if (IS_ERR(dwmac->tx_clk))
+ if (IS_ERR(dwmac->tx_clk)) {
+ ret = PTR_ERR(dwmac->tx_clk);
goto err_remove_config_dt;
+ }

clk_prepare_enable(dwmac->tx_clk);

--
2.9.5


2020-11-16 23:41:39

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe()

On Fri, 13 Nov 2020 14:34:03 +0800 Zhang Changzhong wrote:
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Fixes: 9efc9b2b04c7 ("net: stmmac: Add dwmac-intel-plat for GBE driver")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Zhang Changzhong <[email protected]>
> ---
> drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
> index f61cb99..82b1c7a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
> @@ -113,8 +113,10 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
> /* Enable TX clock */
> if (dwmac->data->tx_clk_en) {
> dwmac->tx_clk = devm_clk_get(&pdev->dev, "tx_clk");
> - if (IS_ERR(dwmac->tx_clk))
> + if (IS_ERR(dwmac->tx_clk)) {
> + ret = PTR_ERR(dwmac->tx_clk);
> goto err_remove_config_dt;
> + }
>
> clk_prepare_enable(dwmac->tx_clk);

Someone should take the look at the error handling later in this
function. It's not checking ret from clk_prepare_enable(), and even tho
top half of this function uses goto, the rest suddenly starts doing
direct returns :S


clk_prepare_enable(dwmac->tx_clk);


/* Check and configure TX clock rate */
rate = clk_get_rate(dwmac->tx_clk);
if (dwmac->data->tx_clk_rate &&
rate != dwmac->data->tx_clk_rate) {
rate = dwmac->data->tx_clk_rate;
ret = clk_set_rate(dwmac->tx_clk, rate);
if (ret) {
dev_err(&pdev->dev,
"Failed to set tx_clk\n");
return ret;
}
}
}

/* Check and configure PTP ref clock rate */
rate = clk_get_rate(plat_dat->clk_ptp_ref);
if (dwmac->data->ptp_ref_clk_rate &&
rate != dwmac->data->ptp_ref_clk_rate) {
rate = dwmac->data->ptp_ref_clk_rate;
ret = clk_set_rate(plat_dat->clk_ptp_ref, rate);
if (ret) {
dev_err(&pdev->dev,
"Failed to set clk_ptp_ref\n");
return ret;
}
}
}

2020-11-16 23:43:19

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe()

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Fri, 13 Nov 2020 14:34:03 +0800 you wrote:
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Fixes: 9efc9b2b04c7 ("net: stmmac: Add dwmac-intel-plat for GBE driver")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Zhang Changzhong <[email protected]>
>
> [...]

Here is the summary with links:
- [net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe()
https://git.kernel.org/netdev/net/c/661710bfd503

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html