diff options
author | YueHaibing <yuehaibing@huawei.com> | 2020-11-12 17:49:36 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-14 23:35:33 +0300 |
commit | 9e6cad531c9de1ba39334fca535af0da5fdf8770 (patch) | |
tree | fcb2ca0883bebe11c449d3f409f5fd22fc57764d /drivers/net/ethernet/cadence | |
parent | 2e793878aece73260f56e84b62e62ef066a0e1fb (diff) | |
download | linux-9e6cad531c9de1ba39334fca535af0da5fdf8770.tar.xz |
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 'drivers/net/ethernet/cadence')
-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; } |