Skip to content

Commit

Permalink
net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_reg…
Browse files Browse the repository at this point in the history
…ister

The fixed_phy_get_gpiod function() returns NULL, it doesn't return error
pointers, using NULL checking to fix this.i

Fixes: 5468e82 ("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>
  • Loading branch information
Miaoqian Lin authored and Jakub Kicinski committed Dec 24, 2021
1 parent 5471d52 commit b45396a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/phy/fixed_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit b45396a

Please sign in to comment.