Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp464306rwr; Wed, 26 Apr 2023 01:39:37 -0700 (PDT) X-Google-Smtp-Source: AKy350ay6UpZxaRRoedbnOJS8yDCFFf8ZhTVrkluOYSgJP8June5vl4mADfnSBJEHc5yi3Wz9wuN X-Received: by 2002:a05:6a20:9388:b0:f2:ad27:f98a with SMTP id x8-20020a056a20938800b000f2ad27f98amr19809786pzh.14.1682498377196; Wed, 26 Apr 2023 01:39:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682498377; cv=pass; d=google.com; s=arc-20160816; b=Fd3uXYQXGkzhxmX0fTEBGNEW4Oqi99NpUMhNsmneqyfxSh/8Ps1CTXevpkW9zO5YBx 4EplaV2ix82Pk+OlmN6Wle65Zn6Amnh6a0NrvMGNCD1iX4rHjCeDc97P4//8+NYCboqo k8LQ4DR9CnKhnrBMOG03CA1Fd7m6DCLjVQlLWCBGIJY318Ey2TGNsmplO2IT8HGsbn6w /cNM1InaPiF/hG41TTX4qR1Cyy5Bl4cYv625XCPCyB3ibXlhcnunAoPP5y+xAiSEnu/P W8D4dcgsIRKUbl+27QEc0NQ0BGr3qrH1Q3JpKBgLCjid237lCLCrLakaPQy0KI9zXVvu abMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=2X1REwQCCwFMihGCGVH5kfEg/ebeje+8z4vEKJ17BBI=; b=wuUh+8kGhA8kDtICzwTzOreoJqlUaryqLDxAGbbOBAPDgblNAvamkHDHoSwi676NRC c4Z/TJhiSsWix5peUy3EbZpyR8djbbODiDlNumKigqxreVkjlTVkiDTN6LgXfTXfZXgd BB7OmCyV4Txc3cPFXV98dTYRvrDMIGsB9fQyEPyzXbmAHAqGiZzYykyodfiX6K0YmkFb +lvANUf5z4sOIvNFc54BzRNmTZTwcTzIiO3mE74Ad0RdfFC9vbFyD2UTnus6XTLDrRgd ZuHfH/Ena/qDE4OOiLxXkN84cYy+j8b+aQ0k9pTb+MTNKL/OghU4GgFOYpw2hHvGfwEQ 0WRw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arinc9.com header.s=zmail header.b=dMH6pKBH; arc=pass (i=1 spf=pass spfdomain=arinc9.com dkim=pass dkdomain=arinc9.com dmarc=pass fromdomain=arinc9.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 u11-20020a6540cb000000b0051ace49ded1si10995729pgp.886.2023.04.26.01.39.13; Wed, 26 Apr 2023 01:39:37 -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=pass header.i=@arinc9.com header.s=zmail header.b=dMH6pKBH; arc=pass (i=1 spf=pass spfdomain=arinc9.com dkim=pass dkdomain=arinc9.com dmarc=pass fromdomain=arinc9.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 S240172AbjDZIZE (ORCPT + 99 others); Wed, 26 Apr 2023 04:25:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240213AbjDZIYe (ORCPT ); Wed, 26 Apr 2023 04:24:34 -0400 Received: from sender4-op-o10.zoho.com (sender4-op-o10.zoho.com [136.143.188.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0170A5253; Wed, 26 Apr 2023 01:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682497373; cv=none; d=zohomail.com; s=zohoarc; b=QsalfbtmyXdTRKWmIqSJrHutOkrEm5PNdAvf5pAyCv2tfxvK+vGsXGmMdPAsCsXw/5wTlh8ippCXkAqSz/Wz2PDQA5S3oKqTpuYwy8ksYthBasGEHDrx9Ox28caRBQlsKVOYwnlfHT7u0EGrGyJWF7qiqQh7gx+TOkTNI7H9Hfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682497373; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=2X1REwQCCwFMihGCGVH5kfEg/ebeje+8z4vEKJ17BBI=; b=mLpT4MBvg9136utdDd6vWSlWaHSiwkDJP0xntKU9KgXSN3ooAOWAWDYTp6axo3ozCGtZ6iwHBVE1AC4WGEMXikWO1QqD/jkXzlcfvJWgMF8+OVd3pIvtfq9z/gHaZJ8MWiEEPR0hU5AWC0GGGxDCXSt7uqw63CfgJpo+6vJpZF8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=arinc9.com; spf=pass smtp.mailfrom=arinc.unal@arinc9.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1682497373; s=zmail; d=arinc9.com; i=arinc.unal@arinc9.com; h=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:Cc:Cc:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=2X1REwQCCwFMihGCGVH5kfEg/ebeje+8z4vEKJ17BBI=; b=dMH6pKBH/AR+ywpNXtkCeS1fzqvzz5NWSDlkRYQYrxfWRWSnrndOUqBhWsbtQma+ D4GlsXiQziPgUns2b7hG04d178DmE/KcPOA5RAe+wAnLt0HlJuFd1QHidU48cPUpy4Q QRvLkV5yv1oEa9usMzo5qdW1eF+jpM81inrFLtGo= Received: from [10.10.10.3] (149.91.1.15 [149.91.1.15]) by mx.zohomail.com with SMTPS id 1682497371872497.30592440788405; Wed, 26 Apr 2023 01:22:51 -0700 (PDT) Message-ID: <0e42a392-f497-125f-d07c-734ecb474771@arinc9.com> Date: Wed, 26 Apr 2023 11:22:37 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH net-next 10/24] net: dsa: mt7530: empty default case on mt7530_setup_port5() Content-Language: en-US To: Daniel Golle 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 , 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 References: <20230425082933.84654-1-arinc.unal@arinc9.com> <20230425082933.84654-11-arinc.unal@arinc9.com> From: =?UTF-8?B?QXLEsW7DpyDDnE5BTA==?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ZohoMailClient: External X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 25.04.2023 18:13, Daniel Golle wrote: > 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. The compiler prints warnings if all enumeration values are not handled. CC drivers/net/dsa/mt7530.o CC drivers/net/dsa/mt7530-mdio.o CC drivers/net/dsa/mt7530-mmio.o drivers/net/dsa/mt7530.c: In function ‘mt7530_setup_port5’: drivers/net/dsa/mt7530.c:919:9: warning: enumeration value ‘P5_DISABLED’ not handled in switch [-Wswitch] 919 | switch (priv->p5_intf_sel) { | ^~~~~~ > >> >> 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. I make use of the default case with ("net: dsa: mt7530: rename p5_intf_sel and use only for MT7530 switch") so I'd rather keep this. Arınç