summaryrefslogtreecommitdiff
path: root/drivers/net/phy/fixed_phy.c
diff options
context:
space:
mode:
authorMiaoqian Lin <linmq006@gmail.com>2021-12-24 02:14:59 +0000
committerJakub Kicinski <kuba@kernel.org>2021-12-24 14:52:10 -0800
commitb45396afa4177f2b1ddfeff7185da733fade1dc3 (patch)
tree846d86c6730cf938e1dc5aaaed8d6a4756d61f9a /drivers/net/phy/fixed_phy.c
parent5471d5226c3b39b3d2f7011c082d5715795bd65c (diff)
net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register
The fixed_phy_get_gpiod function() returns NULL, it doesn't return error pointers, using NULL checking to fix this.i Fixes: 5468e82f7034 ("net: phy: fixed-phy: Drop GPIO from fixed_phy_add()") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Link: https://lore.kernel.org/r/20211224021500.10362-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy/fixed_phy.c')
-rw-r--r--drivers/net/phy/fixed_phy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index c65fb5f5d2dc..a0c256bd5441 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -239,8 +239,8 @@ static struct phy_device *__fixed_phy_register(unsigned int irq,
/* Check if we have a GPIO associated with this fixed phy */
if (!gpiod) {
gpiod = fixed_phy_get_gpiod(np);
- if (IS_ERR(gpiod))
- return ERR_CAST(gpiod);
+ if (!gpiod)
+ return ERR_PTR(-EINVAL);
}
/* Get the next available PHY address, up to PHY_MAX_ADDR */