Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

YueHaibing and committed by
Jakub Kicinski
9e6cad53 2e793878

+2 -8
+2 -8
drivers/net/ethernet/cadence/macb_main.c
··· 3711 3711 } 3712 3712 3713 3713 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; 3718 3715 dev_err(&pdev->dev, "failed to get macb_clk (%d)\n", err); 3719 3716 return err; 3720 3717 } 3721 3718 3722 3719 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; 3727 3721 dev_err(&pdev->dev, "failed to get hclk (%d)\n", err); 3728 3722 return err; 3729 3723 }