Commit 9e6cad53 authored by YueHaibing's avatar YueHaibing Committed by Jakub Kicinski

net: macb: Fix passing zero to 'PTR_ERR'

Check PTR_ERR with IS_ERR to fix this.
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20201112144936.54776-1-yuehaibing@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2e793878
......@@ -3711,19 +3711,13 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
}
if (IS_ERR_OR_NULL(*pclk)) {
err = PTR_ERR(*pclk);
if (!err)
err = -ENODEV;
err = IS_ERR(*pclk) ? PTR_ERR(*pclk) : -ENODEV;
dev_err(&pdev->dev, "failed to get macb_clk (%d)\n", err);
return err;
}
if (IS_ERR_OR_NULL(*hclk)) {
err = PTR_ERR(*hclk);
if (!err)
err = -ENODEV;
err = IS_ERR(*hclk) ? PTR_ERR(*hclk) : -ENODEV;
dev_err(&pdev->dev, "failed to get hclk (%d)\n", err);
return err;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment