From: Yao Zi <me@ziyao.cc>
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>,
Frank <Frank.Sae@motor-comm.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Choong Yong Liang <yong.liang.choong@linux.intel.com>,
Chen-Yu Tsai <wens@csie.org>, Jisheng Zhang <jszhang@kernel.org>,
Furong Xu <0x1207@gmail.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Mingcong Bai <jeffbai@aosc.io>,
Kexy Biscuit <kexybiscuit@aosc.io>, Runhua He <hua@aosc.io>,
Xi Ruoyao <xry111@xry111.site>
Subject: Re: [RFC PATCH net-next v4 2/3] net: stmmac: Add glue driver for Motorcomm YT6801 ethernet controller
Date: Tue, 23 Dec 2025 17:34:45 +0000 [thread overview]
Message-ID: <aUrStfaYuOzjDky2@pie> (raw)
In-Reply-To: <36d87587-d40d-4258-a05f-b7923aea7982@lunn.ch>
On Sun, Dec 21, 2025 at 09:42:20PM +0100, Andrew Lunn wrote:
> > +static int motorcomm_efuse_read_patch(struct dwmac_motorcomm_priv *priv,
> > + u8 index,
> > + struct motorcomm_efuse_patch *patch)
> > +{
> > + u8 buf[sizeof(*patch)], offset;
> > + int i, ret;
> > +
> > + for (i = 0; i < sizeof(*patch); i++) {
> > + offset = EFUSE_PATCH_REGION_OFFSET + sizeof(*patch) * index + i;
> > +
> > + ret = motorcomm_efuse_read_byte(priv, offset, &buf[i]);
> > + if (ret)
> > + return ret;
> > + }
> > +
> > + memcpy(patch, buf, sizeof(*patch));
>
> Why do you write it into a temporary buffer and then copy it to patch?
> Why not put it straight into patch?
Originally I wanted to avoid possible violation of pointer aliasing
rules, so write the RAW data to an extra buffer and do a memcpy() later.
But we have -fno-strict-aliasing in kernel, even without it accessing
any objects with character type should be okay. I'll remove buf and
write to patch directly in v5.
> > + ret = motorcomm_efuse_read_mac(priv, res.mac);
> > + if (ret == -ENOENT) {
> > + dev_warn(&pdev->dev, "eFuse contains no valid MAC address\n");
> > + dev_warn(&pdev->dev, "fallback to random MAC address\n");
> > +
> > + memset(res.mac, 0, sizeof(res.mac));
>
> It is not clear how setting this to zero results in a random MAC
> address. Maybe actually call eth_random_addr()?
stmmac_check_ether_addr() would generate a random MAC address through
eth_random_addr() if res.mac is all zeroes. But I agree calling
eth_random_addr() directly here would be clearer, will do it in v5.
> Andrew
Thanks for your review, happy holiday!
Regards,
Yao Zi
next prev parent reply other threads:[~2025-12-23 17:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 18:03 [RFC PATCH net-next v4 0/3] Add DWMAC glue driver for Motorcomm YT6801 Yao Zi
2025-12-16 18:03 ` [RFC PATCH net-next v4 1/3] net: phy: motorcomm: Support YT8531S PHY in YT6801 Ethernet controller Yao Zi
2025-12-21 20:29 ` Andrew Lunn
2025-12-23 17:40 ` Yao Zi
2025-12-16 18:03 ` [RFC PATCH net-next v4 2/3] net: stmmac: Add glue driver for Motorcomm YT6801 ethernet controller Yao Zi
2025-12-21 20:42 ` Andrew Lunn
2025-12-23 17:34 ` Yao Zi [this message]
2025-12-16 18:03 ` [RFC PATCH net-next v4 3/3] MAINTAINERS: Assign myself as maintainer of Motorcomm DWMAC glue driver Yao Zi
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=aUrStfaYuOzjDky2@pie \
--to=me@ziyao.cc \
--cc=0x1207@gmail.com \
--cc=Frank.Sae@motor-comm.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=hua@aosc.io \
--cc=jeffbai@aosc.io \
--cc=jszhang@kernel.org \
--cc=kexybiscuit@aosc.io \
--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=rmk+kernel@armlinux.org.uk \
--cc=vladimir.oltean@nxp.com \
--cc=wens@csie.org \
--cc=xry111@xry111.site \
--cc=yong.liang.choong@linux.intel.com \
/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