Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2950215rwb; Fri, 9 Dec 2022 08:11:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf4y78tQC/vTbGOGR5z6Z94qOCxXZwsdIMTtHEkpfDPOjjunbvQZrKsr9OPmKqTsFNuAMlli X-Received: by 2002:a05:6a20:b295:b0:ac:6a79:29a with SMTP id ei21-20020a056a20b29500b000ac6a79029amr6586104pzb.54.1670602294731; Fri, 09 Dec 2022 08:11:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670602294; cv=none; d=google.com; s=arc-20160816; b=iFigmkyCeO5Yld1J8Uuhbi63FC0WkHAtfMVxnOj/7urkrHtaXwHlNHxn/0lMv17N6K hFCvz/AgHam1SKqTT/W0zlxVdX+RUHNdAA7gny1CQx5YJRip387oTfiYv6mTeqzzsIll zkKEpeSx3CeFl1PUttwFYpP/hjRwdOHrf+TFLg3XUvzZYZTS4raV+m1PjYlkNxE5mQaT WVtqhLakY+ApWiuCrp07eZCKmuJd9w0GeCKCv+wK7QEd2M4C+Q9nvTEmAwDIML3ZVOqX xcpy8IvcyP0DQiyF/ttnXrDwm0+UT5C1P6ryJ+D3basqMTHwxoGlhMv9RUjWHgBCal6p De2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:to:from :dkim-signature; bh=vPu1TnA9S5JB20iz30vTInnZhejD3tY/wVKnR/slYgA=; b=l3q8nfajLU1/CqV6YuQHFIrdeyE7S4aHVIux85Ck4SQMe5G+Aa04WOQVfdPN3oOXMZ 9h6lgPqARnvDBaTYBxBBi0VM/2WN47p7GohRniL3RGKYOX4usZakX+yydGw7rYDG1Lu3 BNFnP5EFPd5RnLoLDo9kVQsJzfuVIncLhFzUL5JEL6gLTOgZicdS2YOhoz+YvHj5YUGI X2hxP/NIshksiQowwJ+E8RhbutO1Ksl+qXGhku3+t+qGVzfYNS3KmvpQxwajGYunF6WW FgRaTYP+SDKNJN3bLeL0kREo6bQ46bQQoC/DPxLU3cko6iu3UKg23DATDbIEWC3BEWSM Z5Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=b2ARAgl1; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a63cd10000000b00477b3ee6459si1746538pgg.74.2022.12.09.08.11.24; Fri, 09 Dec 2022 08:11:34 -0800 (PST) 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=@microchip.com header.s=mchp header.b=b2ARAgl1; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230202AbiLIPfJ (ORCPT + 75 others); Fri, 9 Dec 2022 10:35:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229646AbiLIPfH (ORCPT ); Fri, 9 Dec 2022 10:35:07 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B020E6B9BE; Fri, 9 Dec 2022 07:35:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670600106; x=1702136106; h=from:to:subject:date:message-id:mime-version; bh=2nhTdbC2PR8CepBOOqGB8k4UrM29lA7Y0BC0ZtFimPw=; b=b2ARAgl1RAo9aR7WYQ6DF9cdP4aSq0jtviuRExlPGuU0v9qvhcjJFzcj GYSE45PaFVi2B77ssTIpf9kQPd1sf5PgSvHeN8LHdLTrSc4QRY6pNzBB3 07cX8/nlDBQos3ssKQemy/SeGe0HsgJPT0riHYDYQbxyNQO3pZVTBRsm0 x3+svwdqPQdh4Xl8q4rSC1ZML8cM5Z8IFItaTlTylhzPVPrQu31BUrik6 18XGzV3d42leilqzxtYaLkwfGx5Bz7FyOMjSzf+8XZfp8nwyC4AM4mrt9 peWGTkTI2UHr1daev0gx1unk6Nl/apJY7ZB9rSipkWynDzzRmKTeQVZh9 Q==; X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="190907093" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Dec 2022 08:35:05 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 9 Dec 2022 08:35:03 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 9 Dec 2022 08:35:02 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , , , , , Jerry Ray Subject: [PATCH v2] net: lan9303: Fix read error execution path Date: Fri, 9 Dec 2022 09:35:02 -0600 Message-ID: <20221209153502.7429-1-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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 This patch fixes an issue where a read failure of a port statistic counter will return unknown results. While it is highly unlikely the read will ever fail, it is much cleaner to return a zero for the stat count. Fixes: a1292595e006 ("net: dsa: add new DSA switch driver for the SMSC-LAN9303") Signed-off-by: Jerry Ray --- v1->v2: corrected email header: net vs net-next, Added 1 maintainer, removed blank line. No changes to the body of the patch. --- drivers/net/dsa/lan9303-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 80f07bd20593..2e270b479143 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1005,9 +1005,11 @@ static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port, ret = lan9303_read_switch_port( chip, port, lan9303_mib[u].offset, ®); - if (ret) + if (ret) { dev_warn(chip->dev, "Reading status port %d reg %u failed\n", port, lan9303_mib[u].offset); + reg = 0; + } data[u] = reg; } } -- 2.17.1