From patchwork Thu Oct 24 13:46:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGFsIFZva8OhxI0=?= X-Patchwork-Id: 1183086 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=ysoft.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ysoft.com header.i=@ysoft.com header.b="n//OPWXd"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46zT7y2vckz9sQm for ; Fri, 25 Oct 2019 00:47:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393825AbfJXNrT (ORCPT ); Thu, 24 Oct 2019 09:47:19 -0400 Received: from uho.ysoft.cz ([81.19.3.130]:52638 "EHLO uho.ysoft.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393816AbfJXNrT (ORCPT ); Thu, 24 Oct 2019 09:47:19 -0400 Received: from iota-build.ysoft.local (unknown [10.1.5.151]) by uho.ysoft.cz (Postfix) with ESMTP id EBF7DA46D1; Thu, 24 Oct 2019 15:47:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ysoft.com; s=20160406-ysoft-com; t=1571924837; bh=09J4vORehZpPUrCjny9gMof7LTXInUPHQqnUVJsRbps=; h=From:To:Cc:Subject:Date:From; b=n//OPWXdEDnZd017TCo9yp15YZ5BasUfGALobr6LZixLa/KX90UNZ2EXqF+uvLOFa ju8lGPSdQIjymJYYp/NA1xqsR7hJ61kdtEvrGcL9qgmUsRmHB+4T/cEqA5hjEb8afU VD8L/E0Nbd2IJXBxfaHo+XJV6TGROvImCTOuDdec= From: =?utf-8?b?TWljaGFsIFZva8OhxI0=?= To: Vivien Didelot , "David S. Miller" , Jakub Kicinski , Andrew Lunn Cc: Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?TWljaGFsIFZva8OhxI0=?= Subject: [PATCH net-next] net: dsa: qca8k: Initialize the switch with correct number of ports Date: Thu, 24 Oct 2019 15:46:58 +0200 Message-Id: <1571924818-27725-1-git-send-email-michal.vokac@ysoft.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since commit 0394a63acfe2 ("net: dsa: enable and disable all ports") the dsa core disables all unused ports of a switch. In this case disabling ports with numbers higher than QCA8K_NUM_PORTS causes that some switch registers are overwritten with incorrect content. To fix this, initialize the dsa_switch->num_ports with correct number of ports. Fixes: 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper") Signed-off-by: Michal Vokáč Reviewed-by: Andrew Lunn --- I actually tried and gave a T-b tag to the whole series that contains the offending commit but obviously I was not careful enough. Who knows what was on my mind and what I actually tested back then. Sorry. drivers/net/dsa/qca8k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index 7e742cd491e8..36c6ed98f8e7 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -1083,7 +1083,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) return -ENOMEM; priv->ds->dev = &mdiodev->dev; - priv->ds->num_ports = DSA_MAX_PORTS; + priv->ds->num_ports = QCA8K_NUM_PORTS; priv->ds->priv = priv; priv->ops = qca8k_switch_ops; priv->ds->ops = &priv->ops;