Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp603637rdf; Tue, 21 Nov 2023 10:54:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8+SSRs4Yql2ilKX0tgOForxiy/nqJQHcGB7Kg6VXkrZriVoX62DfrNHfnljD8nDgfmy7N X-Received: by 2002:a17:90b:1646:b0:280:18bd:ffe7 with SMTP id il6-20020a17090b164600b0028018bdffe7mr66793pjb.48.1700592860883; Tue, 21 Nov 2023 10:54:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700592860; cv=none; d=google.com; s=arc-20160816; b=ckWnJRobWx6QMRSz9KPQ8i2rJNKGlwfAthBng4U5Au2OhVYpJV8vuCVEmeMK9PbOHP xbLn9IMVKADZyffHcxRKgZyH4yv6pvb2O5EmTgCUUrvD/9CSZm6VrzuR1j15G/TaP9By SIc2yp8Rj3nfQ0tq8eBRkYZVrNx2zEa45AycA2/7hE9XJ/lKaBo3U1tz7nCBrIJK7Xid 0dGuKOfzmPrBE0yGhDsHaLPHJSzqoKHZzvu2PL2LUIhMHiTF0NiJNWBHUe//29rQhMhv h0Ru9gwVr0Ai7RRidiwSvZ2rdKEdI98xGvQSVrhoMIUvxdpvo5sJCDgRFvGQTe3lZmd9 ji5w== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ODiuHgN7M/3JDAnpT89vj5beY9SryfK9Bf3VZ+lCLzE=; fh=t3yJgACeTuOw/Q7fRssBgjNkALrPCxhV71SqhWGmIzc=; b=Fi3wUrPwG0qLeCMDHkT8B3M4IiqwAvLcl2g3koLS8yrnENCVQdfM6IUrCLunI1AaLT V4fidc2oeAb28sJh8VK5jywp6JKRMk611teN2FlJz1WlZl8zGmnOyvLG0wKb6VQmI/w8 7sfmp1gA6QfWcaioHYFvlCGlxEX78mEawpECq4FOSUXvtrbCjOki3T3g2degSUaePV7A wsjUk5Zh4+X9BjQFnKwW64jH2I00b7l9mfMpDuDz/GrxeQpHO9iUh5jc1UHOe//Hz53F IzuLtoCxufUXZP0BYOmDEs2BWpQww4IeHH/WcWB/u9FFZO8Ac8UP4G/HNPyElPMrfX93 3U0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ISW9tAm/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id pw9-20020a17090b278900b002851c699781si6515181pjb.154.2023.11.21.10.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 10:54:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ISW9tAm/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8F3488023EC4; Tue, 21 Nov 2023 10:54:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234333AbjKUSyK (ORCPT + 99 others); Tue, 21 Nov 2023 13:54:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231508AbjKUSyJ (ORCPT ); Tue, 21 Nov 2023 13:54:09 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4573193 for ; Tue, 21 Nov 2023 10:54:05 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E211C433C8; Tue, 21 Nov 2023 18:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700592845; bh=co9lMUzvw3BfxT6r7XtEhDDe5hhA8tulVxZdHRcAkE8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ISW9tAm/yGrJQpNo6XTzZkUNwdPwdPqYh/2v/hvXHUByZDPwQ2x45l+FnJg8xw3kz VZbZm7KoTgiEDbrLU9AekSnhiiCC3LTKiakbme3HPHemzht88vslNhl6XeS7sbAWip jAYCp0KSMXy/MqW2S8DpkDiutWV6gqpja3FuMgNkpwMHYrPeVwCmhWWAYY+Lua7Ceq q+ykpM9z9Le4JQ2Gt1lUOgWFwH1Lq1HHJYBxyVFSNL2cqfLCMF2TywHu0OyTPKfH1F Z7n5XSZ/nTZSlAVtjV7hEDbQwlSBf2IAV/b1UKGPaHHn3BifFxyjmzH+ASLEZZxks6 iIuYq8OzNfbDg== Date: Tue, 21 Nov 2023 18:53:58 +0000 From: Simon Horman To: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= Cc: Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Frank Wunderlich , Bartel Eerdekens , mithat.guner@xeront.com, erkin.bozoglu@xeront.com Subject: Re: [PATCH net-next 07/15] net: dsa: mt7530: do not run mt7530_setup_port5() if port 5 is disabled Message-ID: <20231121185358.GA16629@kernel.org> References: <20231118123205.266819-1-arinc.unal@arinc9.com> <20231118123205.266819-8-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231118123205.266819-8-arinc.unal@arinc9.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 21 Nov 2023 10:54:18 -0800 (PST) On Sat, Nov 18, 2023 at 03:31:57PM +0300, Arınç ÜNAL wrote: > There's no need to run all the code on mt7530_setup_port5() if port 5 is > disabled. The only case for calling mt7530_setup_port5() from > mt7530_setup() is when PHY muxing is enabled. That is because port 5 is not > defined as a port on the devicetree, therefore, it cannot be controlled by > phylink. > > Because of this, run mt7530_setup_port5() if priv->p5_intf_sel is > P5_INTF_SEL_PHY_P0 or P5_INTF_SEL_PHY_P4. Remove the P5_DISABLED case from > mt7530_setup_port5(). > > Stop initialising the interface variable as the remaining cases will always > call mt7530_setup_port5() with it initialised. > > Signed-off-by: Arınç ÜNAL > Reviewed-by: Vladimir Oltean > --- > drivers/net/dsa/mt7530.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index fc87ec817672..1aab4c3f28b0 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -942,9 +942,6 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) > /* MT7530_P5_MODE_GMAC: P5 -> External phy or 2nd GMAC */ > val &= ~MHWTRAP_P5_DIS; > break; > - case P5_DISABLED: > - interface = PHY_INTERFACE_MODE_NA; > - break; > default: > dev_err(ds->dev, "Unsupported p5_intf_sel %d\n", > priv->p5_intf_sel); > @@ -2313,8 +2310,6 @@ mt7530_setup(struct dsa_switch *ds) > * Set priv->p5_intf_sel to the appropriate value if PHY muxing > * is detected. > */ > - interface = PHY_INTERFACE_MODE_NA; > - > for_each_child_of_node(dn, mac_np) { > if (!of_device_is_compatible(mac_np, > "mediatek,eth-mac")) > @@ -2346,7 +2341,9 @@ mt7530_setup(struct dsa_switch *ds) > break; > } > > - mt7530_setup_port5(ds, interface); > + if (priv->p5_intf_sel == P5_INTF_SEL_PHY_P0 || > + priv->p5_intf_sel == P5_INTF_SEL_PHY_P4) > + mt7530_setup_port5(ds, interface); Hi Arınç, It appears that interface is now uninitialised here. Flagged by Smatch. > } > > #ifdef CONFIG_GPIOLIB > -- > 2.40.1 >