Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7130452rwr; Tue, 25 Apr 2023 08:28:49 -0700 (PDT) X-Google-Smtp-Source: AKy350bQKn0gZVO0ZJ8oyyHD98pyO6/GwAr0FC/9I2UJPhkKc4Jg9thb88A+ufZpSW1zfTL5p5PJ X-Received: by 2002:a17:903:11d0:b0:1a6:3b04:92bb with SMTP id q16-20020a17090311d000b001a63b0492bbmr26594196plh.18.1682436529474; Tue, 25 Apr 2023 08:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682436529; cv=none; d=google.com; s=arc-20160816; b=H5THjgXRDDbolIC9otPOHxSdsDFiXNXuHPllZraKc8QupHXGxkzayLuCQBWAMls2uX 5Rc0fldsJULymcJy8SoGBftT9LWXKdkoK8aaPaTrT7yOm9wgNBZhyJFrKhrKvefbtwDQ DBfg9rVouZkDyrGsZSLXkB0oqiYa4DjvNanOOqlblwnp7jt//F5kgvdXKQPKtyTDQGf1 SKcgh4XoUOWj4zbPXOQ/qFO5N9t22aut9l8/Uv6L0QmQqwBP8LXYb4ZRC4XEH+mG1S0Y mwDweL7fwVSBRRYRY6UU8zYmBdl7KjOLgu6bl2qFzS/roI6exIJUSn7V/mFlqiRAtbI+ 0eWA== 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; bh=CNYT42o+Do+WGXJABDHdnKjDYOgndsXuitKJD1bWb2s=; b=t7xYEQ3wrZqTsXK393GD3392wb9RiSHh0j5HOHd3yzWZuGlja0rpxU1lE++s8JpC07 F5Gx75XXKGI86WSanAPUkdabKzakJA5dPRZlgGwFgf0vEw8FkOdfPN5+RVDwLBxTf7IF AigLZOm7R7AGGtp8RxTC8B6Ur3T7j4ojYiYSV7NgU1JxyNvNLEbFs8QUZQByqtDbg1wE KxWkIu3jzf8e8W08M4iOrYiSVzc4OkReWR/BG4f/qI+Zsw6+GwKo1Gk5o4K/MFxFb2Lt NcdQ54k/7MdNBJFu6PsU+sQdPn4jr1rZjQXsVhk2P9Ald9ctVeq7L08WsBlJJk8v1DKO gkyg== 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 b13-20020a170902e94d00b001a05d12eeb3si13874889pll.189.2023.04.25.08.28.32; Tue, 25 Apr 2023 08:28:49 -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 S234483AbjDYPPt (ORCPT + 99 others); Tue, 25 Apr 2023 11:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234070AbjDYPPs (ORCPT ); Tue, 25 Apr 2023 11:15:48 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F0A87ED9; Tue, 25 Apr 2023 08:15:46 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1prKO6-0004ZF-0X; Tue, 25 Apr 2023 17:15:26 +0200 Date: Tue, 25 Apr 2023 16:13:36 +0100 From: Daniel Golle To: arinc9.unal@gmail.com Cc: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= , Richard van Schagen , Richard van Schagen , Frank Wunderlich , Bartel Eerdekens , erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH net-next 10/24] net: dsa: mt7530: empty default case on mt7530_setup_port5() Message-ID: References: <20230425082933.84654-1-arinc.unal@arinc9.com> <20230425082933.84654-11-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: <20230425082933.84654-11-arinc.unal@arinc9.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Tue, Apr 25, 2023 at 11:29:19AM +0300, arinc9.unal@gmail.com wrote: > From: Arınç ÜNAL > > There're two code paths for setting up port 5: > > mt7530_setup() > -> mt7530_setup_port5() > > mt753x_phylink_mac_config() > -> mt753x_mac_config() > -> mt7530_mac_config() > -> mt7530_setup_port5() > > On the first code path, priv->p5_intf_sel is either set to > P5_INTF_SEL_PHY_P0 or P5_INTF_SEL_PHY_P4 when mt7530_setup_port5() is run. > > On the second code path, priv->p5_intf_sel is set to P5_INTF_SEL_GMAC5 when > mt7530_setup_port5() is run. > > Empty the default case which will never run but is needed nonetheless to > handle all the remaining enumeration values. If the default: case is really just unreachable code because of the sound reasoning you presented above, then you should just remove it. > > Tested-by: Arınç ÜNAL > Signed-off-by: Arınç ÜNAL > --- > drivers/net/dsa/mt7530.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index aab9ebb54d7d..b3db68d6939a 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -933,9 +933,7 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) > val &= ~MHWTRAP_P5_DIS; > break; > default: > - dev_err(ds->dev, "Unsupported p5_intf_sel %d\n", > - priv->p5_intf_sel); > - goto unlock_exit; > + break; I suppose you can also rather just remove the default: case alltogether instead of keeping it and making it a no-op. > } > > /* Setup RGMII settings */ > @@ -965,7 +963,6 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) > dev_dbg(ds->dev, "Setup P5, HWTRAP=0x%x, intf_sel=%s, phy-mode=%s\n", > val, p5_intf_modes(priv->p5_intf_sel), phy_modes(interface)); > > -unlock_exit: > mutex_unlock(&priv->reg_mutex); > } > > -- > 2.37.2 >