netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ruan Jinjie <ruanjinjie@huawei.com>
To: <rafal@milecki.pl>, <bcm-kernel-feedback-list@broadcom.com>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <opendmb@gmail.com>,
	<florian.fainelli@broadcom.com>, <bryan.whitehead@microchip.com>,
	<UNGLinuxDriver@microchip.com>, <netdev@vger.kernel.org>
Cc: <ruanjinjie@huawei.com>
Subject: [PATCH net-next v3 1/3] net: bgmac: Return PTR_ERR() for fixed_phy_register()
Date: Fri, 18 Aug 2023 15:07:05 +0800	[thread overview]
Message-ID: <20230818070707.3670245-2-ruanjinjie@huawei.com> (raw)
In-Reply-To: <20230818070707.3670245-1-ruanjinjie@huawei.com>

fixed_phy_register() returns -EPROBE_DEFER, -EINVAL and -EBUSY,
etc, in addition to -ENODEV. The best practice is to return
these error codes with PTR_ERR().

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
v3:
- Split the return value check into another patch set.
- Update the commit title and message.
---
 drivers/net/ethernet/broadcom/bgmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 10c7c232cc4e..7c19ba58e9cc 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -1450,7 +1450,7 @@ int bgmac_phy_connect_direct(struct bgmac *bgmac)
 	phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, NULL);
 	if (!phy_dev || IS_ERR(phy_dev)) {
 		dev_err(bgmac->dev, "Failed to register fixed PHY device\n");
-		return -ENODEV;
+		return PTR_ERR(phy_dev);
 	}
 
 	err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link,
-- 
2.34.1


  reply	other threads:[~2023-08-18  7:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18  7:07 [PATCH net-next v3 0/3] net: Return PTR_ERR() for fixed_phy_register() Ruan Jinjie
2023-08-18  7:07 ` Ruan Jinjie [this message]
2023-08-18  7:07 ` [PATCH net-next v3 2/3] net: bcmgenet: " Ruan Jinjie
2023-08-19  0:27   ` Doug Berger
2023-08-19 17:06   ` Simon Horman
2023-08-19 17:10     ` Simon Horman
2023-08-21  1:15       ` Ruan Jinjie
2023-08-18  7:07 ` [PATCH net-next v3 3/3] net: lan743x: " Ruan Jinjie

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=20230818070707.3670245-2-ruanjinjie@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bryan.whitehead@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=rafal@milecki.pl \
    /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).