[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZK_b4s6cQd-lhz1Y@makrotopia.org>
Date: Thu, 13 Jul 2023 12:11:30 +0100
From: Daniel Golle <daniel@...rotopia.org>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: netdev@...r.kernel.org, linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Felix Fietkau <nbd@....name>, John Crispin <john@...ozen.org>,
Sean Wang <sean.wang@...iatek.com>,
Mark Lee <Mark-MC.Lee@...iatek.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Bjørn Mork <bjorn@...k.no>,
Florian Fainelli <f.fainelli@...il.com>,
Greg Ungerer <gerg@...nel.org>
Subject: Re: [PATCH v2 net-next 4/9] net: ethernet: mtk_eth_soc: increase
MAX_DEVS to 3
On Thu, Jul 13, 2023 at 08:07:57AM +0100, Russell King (Oracle) wrote:
> On Thu, Jul 13, 2023 at 03:18:52AM +0100, Daniel Golle wrote:
> > From: Lorenzo Bianconi <lorenzo@...nel.org>
> >
> > This is a preliminary patch to add MT7988 SoC support since it runs 3
> > macs instead of 2.
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> > Signed-off-by: Daniel Golle <daniel@...rotopia.org>
> > ---
> > drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 +++++-
> > drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++--
> > 2 files changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > index 7014e0d108b27..7f191e4337dd8 100644
> > --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > @@ -4030,8 +4030,12 @@ static void mtk_sgmii_destroy(struct mtk_eth *eth)
> > {
> > int i;
> >
> > - for (i = 0; i < MTK_MAX_DEVS; i++)
> > + for (i = 0; i < MTK_MAX_DEVS; i++) {
> > + if (!eth->sgmii_pcs[i])
> > + continue;
> > +
> > mtk_pcs_lynxi_destroy(eth->sgmii_pcs[i]);
> > + }
>
> Please instead arrange for mtk_pcs_lynxi_destroy() to be a no-op if it's
> passed a NULL pointer, which makes it easier to use in error paths (it
> means mtk_pcs_lynxi_destroy() can be called without checks - like
> kfree() etc.)
>
> Since error paths don't get often tested, we need to do as much as
> possible to make error paths trivial.
This is the case already, so the above if-clause can be dropped.
I will do so in v3.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/pcs/pcs-mtk-lynxi.c#n291
Powered by blists - more mailing lists