mbox series

[net-next,0/3] net: Fix return value check for get_phy_device()

Message ID 20230817074000.355564-1-ruanjinjie@huawei.com (mailing list archive)
Headers show
Series net: Fix return value check for get_phy_device() | expand

Message

Jinjie Ruan Aug. 17, 2023, 7:39 a.m. UTC
The get_phy_device() function returns error pointers and never
returns NULL. Update the checks accordingly.

And get_phy_device() returns -EIO on bus access error and -ENOMEM
on kzalloc failure in addition to -ENODEV, return PTR_ERR is more
sensible.

Ruan Jinjie (3):
  net: mdio: Fix return value check for get_phy_device()
  amd-xgbe: Return proper error code for get_phy_device()
  net: hisilicon: hns: Fix return value check for get_phy_device()

 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c       | 2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 4 ++--
 drivers/net/mdio/mdio-xgene.c                     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Leon Romanovsky Aug. 17, 2023, 8:04 a.m. UTC | #1
On Thu, Aug 17, 2023 at 03:39:57PM +0800, Ruan Jinjie wrote:
> The get_phy_device() function returns error pointers and never
> returns NULL. Update the checks accordingly.
> 
> And get_phy_device() returns -EIO on bus access error and -ENOMEM
> on kzalloc failure in addition to -ENODEV, return PTR_ERR is more
> sensible.
> 
> Ruan Jinjie (3):
>   net: mdio: Fix return value check for get_phy_device()
>   amd-xgbe: Return proper error code for get_phy_device()
>   net: hisilicon: hns: Fix return value check for get_phy_device()
> 
>  drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c       | 2 +-
>  drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 4 ++--
>  drivers/net/mdio/mdio-xgene.c                     | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>