* [PATCH net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe()
@ 2020-11-13 6:34 Zhang Changzhong
2020-11-16 23:37 ` Jakub Kicinski
2020-11-16 23:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Zhang Changzhong @ 2020-11-13 6:34 UTC (permalink / raw)
To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
mcoquelin.stm32, vineetha.g.jaya.kumaran, rusaimi.amira.rusaimi
Cc: netdev, linux-kernel
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 <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe()
2020-11-13 6:34 [PATCH net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe() Zhang Changzhong
@ 2020-11-16 23:37 ` Jakub Kicinski
2020-11-16 23:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-16 23:37 UTC (permalink / raw)
To: Zhang Changzhong
Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem,
mcoquelin.stm32, vineetha.g.jaya.kumaran, rusaimi.amira.rusaimi,
netdev, linux-kernel
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 <hulkci@huawei.com>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> ---
> 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;
}
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe()
2020-11-13 6:34 [PATCH net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe() Zhang Changzhong
2020-11-16 23:37 ` Jakub Kicinski
@ 2020-11-16 23:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-16 23:40 UTC (permalink / raw)
To: Zhang Changzhong
Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
mcoquelin.stm32, vineetha.g.jaya.kumaran, rusaimi.amira.rusaimi,
netdev, linux-kernel
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 <hulkci@huawei.com>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
>
> [...]
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-16 23:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 6:34 [PATCH net] net: stmmac: dwmac-intel-plat: fix error return code in intel_eth_plat_probe() Zhang Changzhong
2020-11-16 23:37 ` Jakub Kicinski
2020-11-16 23:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).