From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BD2B79CB for ; Thu, 13 Jul 2023 11:11:51 +0000 (UTC) Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 284361FF1; Thu, 13 Jul 2023 04:11:49 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qJuEa-00082a-0L; Thu, 13 Jul 2023 11:11:44 +0000 Date: Thu, 13 Jul 2023 12:11:30 +0100 From: Daniel Golle To: "Russell King (Oracle)" Cc: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , =?iso-8859-1?Q?Bj=F8rn?= Mork , Florian Fainelli , Greg Ungerer Subject: Re: [PATCH v2 net-next 4/9] net: ethernet: mtk_eth_soc: increase MAX_DEVS to 3 Message-ID: References: <2cc8012ec538106c6bcf22a40b647ec342e687a8.1689012506.git.daniel@makrotopia.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 > > > > This is a preliminary patch to add MT7988 SoC support since it runs 3 > > macs instead of 2. > > > > Signed-off-by: Lorenzo Bianconi > > Signed-off-by: Daniel Golle > > --- > > 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