Message ID | 1548224358-83281-1-git-send-email-weiyongjun1@huawei.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Commit | 8f4ebaaa8d97dc531a3f947a8d30a5a70fe38743 |
Headers | show |
Series | [net-next] net: stmmac: Fix return value check in qcom_ethqos_probe() | expand |
On 23-01-19, 06:19, Wei Yongjun wrote: > In case of error, the function devm_clk_get() returns ERR_PTR() and > never returns NULL. The NULL test in the return value check should be > replaced with IS_ERR(). Acked-by: Vinod Koul <vkoul@kernel.org> This is a networking subsystem patch and you missed Dave :( > Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos") > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > index 30724bd..7ec8954 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > @@ -473,8 +473,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev) > ethqos->por = of_device_get_match_data(&pdev->dev); > > ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii"); > - if (!ethqos->rgmii_clk) { > - ret = -ENOMEM; > + if (IS_ERR(ethqos->rgmii_clk)) { > + ret = PTR_ERR(ethqos->rgmii_clk); > goto err_mem; > } > >
On Wed, Jan 23, 2019 at 06:19:18AM +0000, Wei Yongjun wrote: > In case of error, the function devm_clk_get() returns ERR_PTR() and > never returns NULL. The NULL test in the return value check should be > replaced with IS_ERR(). > > Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos") > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > index 30724bd..7ec8954 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > @@ -473,8 +473,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev) > ethqos->por = of_device_get_match_data(&pdev->dev); > > ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii"); > - if (!ethqos->rgmii_clk) { > - ret = -ENOMEM; > + if (IS_ERR(ethqos->rgmii_clk)) { > + ret = PTR_ERR(ethqos->rgmii_clk); > goto err_mem; > } > > > Acked-by: Niklas Cassel <niklas.cassel@linaro.org>
From: Wei Yongjun <weiyongjun1@huawei.com> Date: Wed, 23 Jan 2019 06:19:18 +0000 > In case of error, the function devm_clk_get() returns ERR_PTR() and > never returns NULL. The NULL test in the return value check should be > replaced with IS_ERR(). > > Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos") > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Applied, thanks.
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 30724bd..7ec8954 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -473,8 +473,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ethqos->por = of_device_get_match_data(&pdev->dev); ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii"); - if (!ethqos->rgmii_clk) { - ret = -ENOMEM; + if (IS_ERR(ethqos->rgmii_clk)) { + ret = PTR_ERR(ethqos->rgmii_clk); goto err_mem; }
In case of error, the function devm_clk_get() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)