Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp976431rwp; Thu, 13 Jul 2023 04:22:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlGjt1obdqVSaSJiCKm79WEN/QD/uhlw154bCdbg/claBmvMHoYQ4rjE4Gb8kDghruCGAhSg X-Received: by 2002:a92:d5cc:0:b0:345:e586:e036 with SMTP id d12-20020a92d5cc000000b00345e586e036mr1195733ilq.28.1689247345677; Thu, 13 Jul 2023 04:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689247345; cv=none; d=google.com; s=arc-20160816; b=I7iXt1aKD5/GsUsHtJqgeFq5cobGsNwOskxyOI+2IXTFXNCkul9iFRmg55YGFhb1MY Uo7T29AfzpKe2YZoX+//ZVOAYkMWjL1afwSMNhkBVSLoE44C8DXrAwDDEsqKZn9E/z9C HDI/ZjXJLyQBZ7PfzzvAxL8x85Se0HlAsP3wCoCnhRe78tW1gw3kSYSMow68e7SFYXQN 0xYRU7ThhBzqnlNdISp0vAvK+At86SsL3eUAvwPxIFP3ZSl8KjSTRU4zjuV+buRFygbX YqyK+pjKCeOUThJtZslP1jeFc7192n6+8Lf2Bbumg+zekWtEro1t+ebe3pHIGUBggjpJ fA8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=mRNXpTF9NpqecxTVG5qGUBRRA0x/zBmH+OMXRKf1tuw=; fh=YSjY4Vz5Yot5oPKVGUhA1urCCtR9eUZSMTzCjAxohoA=; b=GK1xgLjW6OlOiezYQLO5yRmDh7NDaGf0nne2D2hjv4pTm6ogo0S+O2Io85NW/lgqDQ OCN0+rQjvI2hjrVbcvViKHFC7khbyeGFNE94RVXBAl08g2EwcysLyNmRYc6x9oBJ5aR8 /KEKmfkAm1dNjjVS18t9hRI/lxmEMblgWGJQj4AALDJxPFviPHNPdUjdZaA+8gPTGCZ3 wlr6iJvJ0LK8y/y0KHztunW2nCJ+u0Jg1w164apQntq5vu48EwsUt80TYFpvbkzeyGNb obmA732Cv4uzJWuYmGR9OFipZN7wK5vVFPKPFqs7TU5X31DSrIgWpbHG4cpp/88ja8UM cyvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a17090a764e00b00263a923c189si5111794pjl.100.2023.07.13.04.22.13; Thu, 13 Jul 2023 04:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234213AbjGMLLw (ORCPT + 99 others); Thu, 13 Jul 2023 07:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbjGMLLu (ORCPT ); Thu, 13 Jul 2023 07:11:50 -0400 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> 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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