diff options
author | YueHaibing <yuehaibing@huawei.com> | 2020-11-12 15:49:36 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-14 21:35:33 +0100 |
commit | 9e6cad531c9de1ba39334fca535af0da5fdf8770 (patch) | |
tree | fcb2ca0883bebe11c449d3f409f5fd22fc57764d /drivers/net/ethernet/cadence/macb_main.c | |
parent | ipv6: remove unused function ipv6_skb_idev() (diff) | |
download | linux-9e6cad531c9de1ba39334fca535af0da5fdf8770.tar.xz linux-9e6cad531c9de1ba39334fca535af0da5fdf8770.zip |
net: macb: Fix passing zero to 'PTR_ERR'
Check PTR_ERR with IS_ERR to fix this.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20201112144936.54776-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/ethernet/cadence/macb_main.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 51f866288582..7b1d195787dc 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -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; } |