From: "Cédric Le Goater" <clg@kaod.org>
To: Zev Weiss <zev@bewilderbeest.net>, Joel Stanley <joel@jms.id.au>,
<openbmc@lists.ozlabs.org>
Cc: Andrew Jeffery <andrew@aj.id.au>, Ryan Chen <ryan_chen@aspeedtech.com>
Subject: Re: [PATCH] ftgmac100: use bus name in mdio error messages
Date: Tue, 17 May 2022 07:44:54 +0200 [thread overview]
Message-ID: <ab0ef71d-8070-c358-1c75-2fbade20c727@kaod.org> (raw)
In-Reply-To: <20220517043825.26893-1-zev@bewilderbeest.net>
Hello Zev,
On 5/17/22 06:38, Zev Weiss wrote:
> Previously we'd been using a device name retrieved via
> ftgmac100_data->phydev, but the mdio read/write functions may be
> called before that member is initialized in ftgmac100_phy_init(),
> leading to a NULL pointer dereference while printing the error message
> issued if the mdio access fails. We can instead use bus->name, which
> is already available at that point.
>
> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> Fixes: 538e75d3fc54 ("net: ftgmac100: add MDIO bus and phylib support")
You should send upstream.
Thanks,
C.
> ---
> drivers/net/ftgmac100.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
> index 999941de14ac..aa1d63880c8c 100644
> --- a/drivers/net/ftgmac100.c
> +++ b/drivers/net/ftgmac100.c
> @@ -117,7 +117,7 @@ static int ftgmac100_mdio_read(struct mii_dev *bus, int phy_addr, int dev_addr,
> FTGMAC100_MDIO_TIMEOUT_USEC);
> if (ret) {
> pr_err("%s: mdio read failed (phy:%d reg:%x)\n",
> - priv->phydev->dev->name, phy_addr, reg_addr);
> + bus->name, phy_addr, reg_addr);
> return ret;
> }
>
> @@ -149,7 +149,7 @@ static int ftgmac100_mdio_write(struct mii_dev *bus, int phy_addr, int dev_addr,
> FTGMAC100_MDIO_TIMEOUT_USEC);
> if (ret) {
> pr_err("%s: mdio write failed (phy:%d reg:%x)\n",
> - priv->phydev->dev->name, phy_addr, reg_addr);
> + bus->name, phy_addr, reg_addr);
> }
>
> return ret;
prev parent reply other threads:[~2022-05-17 5:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 4:38 [PATCH] ftgmac100: use bus name in mdio error messages Zev Weiss
2022-05-17 4:51 ` Zev Weiss
2022-05-17 4:54 ` Joel Stanley
2022-05-17 9:28 ` Zev Weiss
2022-05-17 9:31 ` Joel Stanley
2022-05-17 5:44 ` Cédric Le Goater [this message]
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=ab0ef71d-8070-c358-1c75-2fbade20c727@kaod.org \
--to=clg@kaod.org \
--cc=andrew@aj.id.au \
--cc=joel@jms.id.au \
--cc=openbmc@lists.ozlabs.org \
--cc=ryan_chen@aspeedtech.com \
--cc=zev@bewilderbeest.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.