Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp780123rwp; Thu, 13 Jul 2023 00:23:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlFO7GCqY+bgFQ0AIiNaxWzhrXx55UeHo23dOBmnKykc0TCO19hGJwzgm5Z5KJ650HNtC92Y X-Received: by 2002:a05:6512:234a:b0:4fb:8b2a:5e09 with SMTP id p10-20020a056512234a00b004fb8b2a5e09mr576692lfu.43.1689233015128; Thu, 13 Jul 2023 00:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689233015; cv=none; d=google.com; s=arc-20160816; b=LOaMiuIC21o/LDmITj71TPfw0Vii+fxu0bGrKO4FmRSvWLejMR4uOmpDmiPT/LLSH4 pceDF4iIfd6vfD4igkdUYB+UQWwo79g40+bJDGT0qycI+PVCENI14wcqADQWQdYQcU7P TFj5oKsrcds35FTkNS47Dqh61HaMvhe+o+t40c/ayVHqDuYmweHwuOuLoWNlnShQzZmp B3ArMrYlL+2WiUfK6EDgRB4zZVEhicmH4LZP52MSqADUOogvmeRAWeNFICzCamvHMgqi Prt8n+bO43jLVGcasKtlHUfSOunnkyih1zwimx7Oka6VXtsb9oxUi245I/h+XBR5ZIK5 vCqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=hdGx1K3RjF5TT01b8U4Kk8AYjp2IPrWjWa8zM6ieITE=; fh=y6Nt63VVXY4On7n4MaqUr6QkIhGQzHbb1r/8aivKFpw=; b=Hwc0E7enxRt/KktfIerDOXPvqooWI/b855gEbCL07ldJuiC+tVPw1Y1Y/+JD3fa6gx nRosGgJ5MEGKpTk0SaI6tiCc/Ofy4rpuhTt4YE0wRiXegvKFs2X3glZJ7dfF9Y4AAawp DefJHn+FFKLY2Fu/o86HLhTa8fILZUlG7dtsuOwMHGqdFoWza1Vvo71mmEThHbtBe3xa Zo9PQdQjBOKIdzSTRORGdR4R8g5ZilucU4D4v9yPfJJSLex6A1SgG8VHZAdLuDeZRU29 soj2uLMEzsYByTLUODOz8OhCZ6tUf2UEyMfAGaJaj96gf47+2Z1WIHOuxsvMNCOeVofl pKcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=JugqstoB; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x26-20020aa7d6da000000b0051e0591969dsi6371035edr.345.2023.07.13.00.23.11; Thu, 13 Jul 2023 00:23:35 -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; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=JugqstoB; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231572AbjGMHIH (ORCPT + 99 others); Thu, 13 Jul 2023 03:08:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234136AbjGMHIC (ORCPT ); Thu, 13 Jul 2023 03:08:02 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A22C7211E; Thu, 13 Jul 2023 00:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hdGx1K3RjF5TT01b8U4Kk8AYjp2IPrWjWa8zM6ieITE=; b=JugqstoBFWytUNEtdyZjbsNqKN kg6eSi0xlUBPQzyzpt/3EGI2RiTg6w98eeegWwfxItBXDFEkcV/CBfNG4Goh0Q7jPe9icSD7oStGn +Q7ZfTbcHLCuxSAKJhy/IqJVClovAg+DoEsjXB/pcaJ7wKYmaLpHZCKvw8oQfCq/WRkJWWnKF1Rmp ll2W0Vcwantvht6diGhv2s0QO+n0RvNrOYsFFgBa3+YWIHDDId6xWmHqdioWQbA2lsfivpoY1lD3B 5pTjBgwFZIRaoCx6Yqegqa9CDx6CHJ0GSWxo0OttJ9WAz330MqclE6MzFbMVOGc9QWjXww81bDlDb 5uqB3Www==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:33956) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qJqQg-0005py-0o; Thu, 13 Jul 2023 08:07:58 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qJqQf-0005uz-Dm; Thu, 13 Jul 2023 08:07:57 +0100 Date: Thu, 13 Jul 2023 08:07:57 +0100 From: "Russell King (Oracle)" To: Daniel Golle 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: <2cc8012ec538106c6bcf22a40b647ec342e687a8.1689012506.git.daniel@makrotopia.org> Sender: Russell King (Oracle) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 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. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!