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 <hul...@huawei.com> > Signed-off-by: Zhang Changzhong <zhangchangzh...@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; } } }