From: Christian Marangi <ansuelsmth@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Marek Behún" <kabel@kernel.org>,
"Andrei Botila" <andrei.botila@oss.nxp.com>,
"Sabrina Dubroca" <sd@queasysnail.net>,
"Daniel Golle" <daniel@makrotopia.org>,
"Eric Woudstra" <ericwouds@gmail.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH v6 5/6] net: phy: Add support for Aeonsemi AS21xxx PHYs
Date: Thu, 10 Apr 2025 11:57:24 +0200 [thread overview]
Message-ID: <67f7960a.050a0220.3a2285.9d15@mx.google.com> (raw)
In-Reply-To: <29bbd0c3-a64d-4aef-a0b2-5ec4999ff7e1@lunn.ch>
On Wed, Apr 09, 2025 at 06:29:59PM +0200, Andrew Lunn wrote:
> > +static int aeon_ipc_get_fw_version(struct phy_device *phydev)
> > +{
> > + u16 ret_data[8], data[1];
> > + u16 ret_sts;
> > + int ret;
> > +
> > + data[0] = IPC_INFO_VERSION;
> > + ret = aeon_ipc_send_msg(phydev, IPC_CMD_INFO, data,
> > + sizeof(data), &ret_sts);
> > + if (ret)
> > + return ret;
> > +
> > + ret = aeon_ipc_rcv_msg(phydev, ret_sts, ret_data);
> > + if (ret < 0)
> > + return ret;
> > +
> > + phydev_info(phydev, "Firmware Version: %s\n", (char *)ret_data);
>
> Maybe don't trust the firmware to return a \0 terminated string?
>
> > +static int as21xxx_match_phy_device(struct phy_device *phydev,
> > + const struct phy_driver *phydrv)
> > +{
> > + /* Sync parity... */
> > + ret = aeon_ipc_sync_parity(phydev, priv);
> > + if (ret)
> > + goto out;
> > +
> > + /* ...and send a third NOOP cmd to wait for firmware finish loading */
> > + ret = aeon_ipc_noop(phydev, priv, &ret_sts);
> > + if (ret)
> > + goto out;
> > +
> > +out:
> > + mutex_destroy(&priv->ipc_lock);
> > + kfree(priv);
> > +
> > + /* Return not maching anyway as PHY ID will change after
> > + * firmware is loaded. This relies on the driver probe
> > + * order where the first PHY driver probed is the
> > + * generic one.
> > + */
> > + return ret;
> > +}
>
> This is not obvious. ret is either an error code, and we want to
> return it. Or it is 0 because aeon_ipc_noop() returned 0 on success.
> But the code then turns that 0 success into a false, does not match.
> I think this last bit needs commenting on.
>
> With those two fixed, you can add my Reviewed-by:
>
Hi Andrew,
I just sent v7 but I didn't add the review tag just to make sure you are
ok with the additional comments and handling of NULL terminated string.
--
Ansuel
next prev parent reply other threads:[~2025-04-10 9:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 20:09 [net-next PATCH v6 0/6] net: phy: Add support for new Aeonsemi PHYs Christian Marangi
2025-04-07 20:09 ` [net-next PATCH v6 1/6] net: phy: pass PHY driver to .match_phy_device OP Christian Marangi
2025-04-07 20:09 ` [net-next PATCH v6 2/6] net: phy: bcm87xx: simplify " Christian Marangi
2025-04-07 20:09 ` [net-next PATCH v6 3/6] net: phy: nxp-c45-tja11xx: " Christian Marangi
2025-04-07 20:09 ` [net-next PATCH v6 4/6] net: phy: introduce genphy_match_phy_device() Christian Marangi
2025-04-07 20:09 ` [net-next PATCH v6 5/6] net: phy: Add support for Aeonsemi AS21xxx PHYs Christian Marangi
2025-04-09 16:29 ` Andrew Lunn
2025-04-10 9:57 ` Christian Marangi [this message]
2025-04-07 20:09 ` [net-next PATCH v6 6/6] dt-bindings: net: Document support for Aeonsemi PHYs Christian Marangi
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=67f7960a.050a0220.3a2285.9d15@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=andrei.botila@oss.nxp.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=ericwouds@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=kabel@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=sd@queasysnail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox