From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] net: designware: eqos: fix NULL pointer use in dev_printf
Date: Fri, 15 Nov 2019 08:32:39 +0100 [thread overview]
Message-ID: <20191115073239.21013-4-ahmad@a3f.at> (raw)
In-Reply-To: <20191115073239.21013-1-ahmad@a3f.at>
Inside mdio_register, a read of the PHY's id register is attempted.
If it fails, we print an error message with eqos_err, which uses the
ethernet device's unique name, but at this time there has been none set,
because eth_register was not yet called. Fix this by using the MDIO bus
device instead.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
drivers/net/designware_eqos.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
index 84dcd04a3fc9..da67adf9a0f0 100644
--- a/drivers/net/designware_eqos.c
+++ b/drivers/net/designware_eqos.c
@@ -204,7 +204,7 @@ static int eqos_mdio_read(struct mii_bus *bus, int addr, int reg)
ret = eqos_mdio_wait_idle(eqos);
if (ret) {
- eqos_err(eqos, "MDIO not idle at entry\n");
+ dev_err(&bus->dev, "MDIO not idle at entry\n");
return ret;
}
@@ -222,7 +222,7 @@ static int eqos_mdio_read(struct mii_bus *bus, int addr, int reg)
ret = eqos_mdio_wait_idle(eqos);
if (ret) {
- eqos_err(eqos, "MDIO read didn't complete\n");
+ dev_err(&bus->dev, "MDIO read didn't complete\n");
return ret;
}
@@ -237,7 +237,7 @@ static int eqos_mdio_write(struct mii_bus *bus, int addr, int reg, u16 val)
ret = eqos_mdio_wait_idle(eqos);
if (ret) {
- eqos_err(eqos, "MDIO not idle at entry\n");
+ dev_err(&bus->dev, "MDIO not idle at entry\n");
return ret;
}
@@ -256,7 +256,7 @@ static int eqos_mdio_write(struct mii_bus *bus, int addr, int reg, u16 val)
ret = eqos_mdio_wait_idle(eqos);
if (ret) {
- eqos_err(eqos, "MDIO read didn't complete\n");
+ dev_err(&bus->dev, "MDIO read didn't complete\n");
return ret;
}
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-11-15 7:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 9:56 [PATCH 0/1] net: designware: eqos: stop DMA on halt Ahmad Fatoum
2019-11-11 9:56 ` [PATCH 1/1] " Ahmad Fatoum
2019-11-12 12:00 ` Sascha Hauer
2019-11-15 7:32 ` [PATCH v2 0/3] " Ahmad Fatoum
2019-11-15 7:32 ` [PATCH 1/3] net: designware: eqos: properly " Ahmad Fatoum
2019-11-15 7:32 ` [PATCH 2/3] net: designware: eqos: enable clocks before mdio_register Ahmad Fatoum
2019-11-15 7:32 ` Ahmad Fatoum [this message]
2019-11-15 13:41 ` [PATCH v2 0/3] net: designware: eqos: stop DMA on halt Sascha Hauer
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=20191115073239.21013-4-ahmad@a3f.at \
--to=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
/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