Skip to content

Commit b45396a

Browse files
Yuuoniykuba-moo
authored andcommitted
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: 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>
1 parent 5471d52 commit b45396a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/net/phy/fixed_phy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ static struct phy_device *__fixed_phy_register(unsigned int irq,
239239
/* Check if we have a GPIO associated with this fixed phy */
240240
if (!gpiod) {
241241
gpiod = fixed_phy_get_gpiod(np);
242-
if (IS_ERR(gpiod))
243-
return ERR_CAST(gpiod);
242+
if (!gpiod)
243+
return ERR_PTR(-EINVAL);
244244
}
245245

246246
/* Get the next available PHY address, up to PHY_MAX_ADDR */

0 commit comments

Comments
 (0)