Skip to content

Commit 9e6cad5

Browse files
YueHaibingkuba-moo
authored andcommitted
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>
1 parent 2e79387 commit 9e6cad5

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3711,19 +3711,13 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
37113711
}
37123712

37133713
if (IS_ERR_OR_NULL(*pclk)) {
3714-
err = PTR_ERR(*pclk);
3715-
if (!err)
3716-
err = -ENODEV;
3717-
3714+
err = IS_ERR(*pclk) ? PTR_ERR(*pclk) : -ENODEV;
37183715
dev_err(&pdev->dev, "failed to get macb_clk (%d)\n", err);
37193716
return err;
37203717
}
37213718

37223719
if (IS_ERR_OR_NULL(*hclk)) {
3723-
err = PTR_ERR(*hclk);
3724-
if (!err)
3725-
err = -ENODEV;
3726-
3720+
err = IS_ERR(*hclk) ? PTR_ERR(*hclk) : -ENODEV;
37273721
dev_err(&pdev->dev, "failed to get hclk (%d)\n", err);
37283722
return err;
37293723
}

0 commit comments

Comments
 (0)