public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: u-boot@lists.denx.de
Subject: [RFC PATCH 1/3] phy: make phy_connect_fixed work with a null mdio bus
Date: Sun,  3 May 2020 21:52:25 +0300	[thread overview]
Message-ID: <20200503185227.28731-2-olteanv@gmail.com> (raw)
In-Reply-To: <20200503185227.28731-1-olteanv@gmail.com>

From: Vladimir Oltean <vladimir.oltean@nxp.com>

It is utterly pointless to require an MDIO bus pointer for a fixed PHY
device. The fixed.c implementation does not require it, only
phy_device_create. Fix that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/phy/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 9a66e62e8974..dcef1aaf2026 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -651,7 +651,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
 	dev = malloc(sizeof(*dev));
 	if (!dev) {
 		printf("Failed to allocate PHY device for %s:%d\n",
-		       bus->name, addr);
+		       bus ? bus->name : "(null bus)", addr);
 		return NULL;
 	}
 
@@ -679,7 +679,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
 		return NULL;
 	}
 
-	if (addr >= 0 && addr < PHY_MAX_ADDR)
+	if (addr >= 0 && addr < PHY_MAX_ADDR && phy_id != PHY_FIXED_ID)
 		bus->phymap[addr] = dev;
 
 	return dev;
-- 
2.17.1

  reply	other threads:[~2020-05-03 18:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 18:52 [RFC PATCH 0/3] DM_MDIO for fsl_tsec driver Vladimir Oltean
2020-05-03 18:52 ` Vladimir Oltean [this message]
2020-05-04  6:08   ` [RFC PATCH 1/3] phy: make phy_connect_fixed work with a null mdio bus Z.q. Hou
2020-05-03 18:52 ` [RFC PATCH 2/3] configs: enable DM_MDIO for LS1021A-TWR and LS1021A-TSN Vladimir Oltean
2020-05-03 18:52 ` [RFC PATCH 3/3] net: tsec: convert fsl_pq_mdio to DM_MDIO Vladimir Oltean
2020-05-04  6:22   ` Z.q. Hou
2020-05-04  8:06     ` Vladimir Oltean
2020-05-05  9:34   ` Madalin Bucur
2020-07-15 10:37     ` Priyanka Jain

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=20200503185227.28731-2-olteanv@gmail.com \
    --to=olteanv@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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