netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ruan Jinjie <ruanjinjie@huawei.com>
To: <Shyam-sundar.S-k@amd.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<yisen.zhuang@huawei.com>, <salil.mehta@huawei.com>,
	<iyappan@os.amperecomputing.com>, <keyur@os.amperecomputing.com>,
	<quan@os.amperecomputing.com>, <andrew@lunn.ch>,
	<hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
	<yankejian@huawei.com>, <netdev@vger.kernel.org>
Cc: <ruanjinjie@huawei.com>
Subject: [PATCH net-next 3/3] net: hisilicon: hns: Fix return value check for get_phy_device()
Date: Thu, 17 Aug 2023 15:40:00 +0800	[thread overview]
Message-ID: <20230817074000.355564-4-ruanjinjie@huawei.com> (raw)
In-Reply-To: <20230817074000.355564-1-ruanjinjie@huawei.com>

The get_phy_device() function returns error pointers and never
returns NULL. Update the checks accordingly.

Fixes: 1d1afa2ebf82 ("net: hns: register phy device in each mac initial sequence")
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 928d934cb21a..13b5ee548744 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -705,8 +705,8 @@ hns_mac_register_phydev(struct mii_bus *mdio, struct hns_mac_cb *mac_cb,
 		return -ENODATA;
 
 	phy = get_phy_device(mdio, addr, is_c45);
-	if (!phy || IS_ERR(phy))
-		return -EIO;
+	if (IS_ERR(phy))
+		return PTR_ERR(phy);
 
 	phy->irq = mdio->irq[addr];
 
-- 
2.34.1


  parent reply	other threads:[~2023-08-17  7:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17  7:39 [PATCH net-next 0/3] net: Fix return value check for get_phy_device() Ruan Jinjie
2023-08-17  7:39 ` [PATCH net-next 1/3] net: mdio: " Ruan Jinjie
2023-08-17 12:25   ` Andrew Lunn
2023-08-17  7:39 ` [PATCH net-next 2/3] amd-xgbe: Return proper error code " Ruan Jinjie
2023-08-17  8:09   ` Shyam Sundar S K
2023-08-17 12:28   ` Andrew Lunn
2023-08-17 12:54     ` Ruan Jinjie
2023-08-17  7:40 ` Ruan Jinjie [this message]
2023-08-17 12:29   ` [PATCH net-next 3/3] net: hisilicon: hns: Fix return value check " Andrew Lunn
2023-08-17  8:04 ` [PATCH net-next 0/3] net: " Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230817074000.355564-4-ruanjinjie@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=iyappan@os.amperecomputing.com \
    --cc=keyur@os.amperecomputing.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quan@os.amperecomputing.com \
    --cc=salil.mehta@huawei.com \
    --cc=yankejian@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).