From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08091C6FD18 for ; Tue, 25 Apr 2023 15:15:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234269AbjDYPPv (ORCPT ); Tue, 25 Apr 2023 11:15:51 -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> 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 >