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 1/3] net: mdio: Fix return value check for get_phy_device()
Date: Thu, 17 Aug 2023 15:39:58 +0800	[thread overview]
Message-ID: <20230817074000.355564-2-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: 43b3cf6634a4 ("drivers: net: phy: xgene: Add MDIO driver")
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 drivers/net/mdio/mdio-xgene.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mdio/mdio-xgene.c b/drivers/net/mdio/mdio-xgene.c
index 683e8f8319ab..4e097ce2a7fd 100644
--- a/drivers/net/mdio/mdio-xgene.c
+++ b/drivers/net/mdio/mdio-xgene.c
@@ -265,7 +265,7 @@ struct phy_device *xgene_enet_phy_register(struct mii_bus *bus, int phy_addr)
 	struct phy_device *phy_dev;
 
 	phy_dev = get_phy_device(bus, phy_addr, false);
-	if (!phy_dev || IS_ERR(phy_dev))
+	if (IS_ERR(phy_dev))
 		return NULL;
 
 	if (phy_device_register(phy_dev))
-- 
2.34.1


  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 ` Ruan Jinjie [this message]
2023-08-17 12:25   ` [PATCH net-next 1/3] net: mdio: " 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 ` [PATCH net-next 3/3] net: hisilicon: hns: Fix return value check " Ruan Jinjie
2023-08-17 12:29   ` 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-2-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).