Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2099710iof; Tue, 7 Jun 2022 19:43:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4PHru0t2f5CqHBbFaV64TaM8q3W7r7MUDECEuZBfooWjOV7Z9Qbst2rtL0qtPtssLBe8D X-Received: by 2002:a05:6a00:194d:b0:51b:eb84:49b1 with SMTP id s13-20020a056a00194d00b0051beb8449b1mr22780701pfk.77.1654656232724; Tue, 07 Jun 2022 19:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654656232; cv=none; d=google.com; s=arc-20160816; b=wjGUOuClBUL3TG/4/bUtK8ZbT8Wf/vlyUvvZQf0ImVxFf02TDlZTjFj+P8PWt51Jz4 1+dXB/XLa0wRv+APT5ybc31uuQDwFIxiXRW7mh0eybdG1PEJlHeV7vtfl7m76N1R1Lll pCUvDyi/7QoEMYPaae333m5niKOxDPF9p5APmRv8enh81K9rGsiWrPVWII8SuYlecrqr cfO+2DN558tCxzbIztagpraQ7nJXxir9IPSxSXM8cebM17EKnAlYO3D1FklkRvSoAfau umZa/sK/fOAOp9MM0hxayjQ5NkUn9QQdIofc9ZIciQZGPF7ejTzqCFWS1syjAVMYFDJ6 qLyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EroEefEqaj1ReEaNmY4SAGMLk8bHbMIi5So7GU3zO0g=; b=gXs2Ja8f4JHGMNT585IVdJHgkVinj2BsbtgMPun1+k175ieKbCDJlllYmgcgUT/2sm /K/8F0neLyAowaRMWCKwOj7jEmedYMfhflcnSB8f7SVNrMwbYB5mJ1vJBAYTA2mASS6a DncInli1y77qHRLRM+J0klnoe6XaGdEZtr10RWzI5qre0RcWwyLpqqOV4htD/W5jMPRt E7PoxUcUQ4L9ECj6ML+HzPATuDMWQ7ifmet2sgIQ78Y6/1V0HszMXLDvSt4D55XJoGx1 4rr5UaVPbzx5g/2pNs4X4BQpq0xH317QAYdGzbN/L61hrfs8ZqPjzrY4Uonp07AzU4ny m3kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g51XDyPC; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id nn17-20020a17090b38d100b001e27c577233si34050943pjb.136.2022.06.07.19.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:43:52 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g51XDyPC; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CFA9D23CF6E; Tue, 7 Jun 2022 18:04:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383116AbiFGWeE (ORCPT + 99 others); Tue, 7 Jun 2022 18:34:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378213AbiFGVWN (ORCPT ); Tue, 7 Jun 2022 17:22:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA974133269; Tue, 7 Jun 2022 12:00:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 939E1617DA; Tue, 7 Jun 2022 19:00:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3658C385A5; Tue, 7 Jun 2022 19:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628402; bh=58lJsLP5IalNjhnV2OFb+wisSpm/oUI8y24iln421mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g51XDyPCOASv1tUZNxx1sSRp3BtWiBq/kMEXGUKZvoiauNajvdPzC0wiCstLtinsO j0I4dTexYmsXddEPRjqaiLhOn0Ve5OdyEecQ6GUKhiCShGideNJcoXKowSIzvn9cAG 7Bzv5IuCPxoTE5o01DqFIys+twAJjDM3t4juJxKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ansuel Smith , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 315/879] net: dsa: qca8k: correctly handle mdio read error Date: Tue, 7 Jun 2022 18:57:13 +0200 Message-Id: <20220607165011.991520585@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ansuel Smith [ Upstream commit 6cfc03b602200c5cbbd8d906fd905547814e83df ] Restore original way to handle mdio read error by returning 0xffff. This was wrongly changed when the internal_mdio_read was introduced, now that both legacy and internal use the same function, make sure that they behave the same way. Fixes: ce062a0adbfe ("net: dsa: qca8k: fix kernel panic with legacy mdio mapping") Signed-off-by: Ansuel Smith Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/dsa/qca8k.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index d3ed0a7f8077..22b328bd7cd5 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -1287,7 +1287,12 @@ qca8k_internal_mdio_read(struct mii_bus *slave_bus, int phy, int regnum) if (ret >= 0) return ret; - return qca8k_mdio_read(priv, phy, regnum); + ret = qca8k_mdio_read(priv, phy, regnum); + + if (ret < 0) + return 0xffff; + + return ret; } static int -- 2.35.1