Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2612501pxb; Sun, 17 Oct 2021 20:29:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXMHr9AsJql22X0/5gCypsPkxR10rQGUyrlntPVy4ezpI1DQJFUGkP41WoFZEZjxemD9QI X-Received: by 2002:a63:7055:: with SMTP id a21mr15360434pgn.338.1634527789047; Sun, 17 Oct 2021 20:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634527789; cv=none; d=google.com; s=arc-20160816; b=0Z8XsyNR6rMx4RkhOW1DsOc/Ab1oZK2YwKEhZL3ZtgM0GZwvwZEHGep710/rs59InP psWAMIkUDVmDAtSnOdD5L7ri3LRiNyKGKZiU8XzE8FlOT8k8b7bVUEiSCkyrVR6PTnAz da0uNVoh/w5C/2kc/ntNcf8BjjdPaCws5lEDA0BZu/X8xEoF1SfXyrBcYYw8PT4pNbK6 bVyvFpUQhuRkbaJUY6HeFfIQubgIctkM4V6S2R56eMVSIj6/pcbb9AErUi6kYaR+um+v cUvFKkJdaCk0JfvxtB+hMtWbFWH4VMAtg6SsZrnXhfjLSgMiCUN86l9c3yOKbtzf+HAV U2eA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=ZvOvoZcvvH/Tx90si2pKJuiA/fIC5HYugtK+5A8dZIs=; b=LFnT+sLgdlvF7QnKt3/sWFmw7HwiojhfLIGwh0iakwWsdOyMqWm0FVcLWnjEKfQSKL zE0rpXZdaX01q2/zz0GCqPwf1mwqgxyr7owuK7XyrQe78Y1Mw7urd/fx2SihBT3yqZE/ hboTc/NgXLz5mU656I2MjuMQYB2GLH3+9C2gj1bO3La1l564AfoUTMpRo3ygA1f3VDMK bamR7eGaiuVBDt9pvLXhT1kkEMau7FGoXgdwtFDu4w1h8jzk+Al/cBdysOBJ/NkdVvu1 xiPQilaIRyHfZX06axtzgHcXDIvfe78Y9RhYV177HdVG4jkUHZ4mkBbVNKUrtGXIIe9D h6zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=adWh4ygP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a24si18118802plm.211.2021.10.17.20.29.37; Sun, 17 Oct 2021 20:29:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=adWh4ygP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239911AbhJPG0e (ORCPT + 98 others); Sat, 16 Oct 2021 02:26:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239451AbhJPG0d (ORCPT ); Sat, 16 Oct 2021 02:26:33 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C21BFC061570; Fri, 15 Oct 2021 23:24:25 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id l6so7726542plh.9; Fri, 15 Oct 2021 23:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZvOvoZcvvH/Tx90si2pKJuiA/fIC5HYugtK+5A8dZIs=; b=adWh4ygPqc92epNkTraqhJCi7bUk4sjO5zyT+A14oTHay7XdUEdrusc0T7n4dkJWr8 iuYo+Wx9Twyue8mGvq71xjUsiHbNgE07aZSGVxQhDBv7t2zmYCjzpcYDD0Lwa3Oewc1O ncs3GLLEsK2mqJt3jrezh6hJ7sDe7oub0C7Q2E0raaAzhpeRysyKDnS7ALzmIgSI7W5J iFVAeygq2FgIZqnuCK2xjln6M6LtSIXKitatPcbCy9tEQJGYyv77WE3dnq+eL+dPLefR Qoie4B4uSaOBdnXp58iT0M0aUVkp7uTxAaQegU6Jz6R/trZj//vVu6CTwYjfQSVd3cBv P12A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZvOvoZcvvH/Tx90si2pKJuiA/fIC5HYugtK+5A8dZIs=; b=uztWHbeQFZlLdZLn6qiwpyzP6kTMY6CbB3xZIBZaTRUTtCMr2c+Gh9zLVWzHsubf4x rZHYzNwDHyPh2JS9PhKSNqpfWnNlbP2N6rbW/zMGpAdn631bgBPc1sNdpMNv56dCGg1M LvcxH1490DMlrs+ngkTPGhckjsIVZ/Efmq1wOvOhOjFjhrKz4mAlcogx0h7tB/YKMmo2 QR6fbDrfKjf+83mWw0iFr9faGCy+pzYAwZKcHkmhUEjACbgXmxZXudQMg3LecSVIuhnn jFHnQGcXN8dAVlOJ6GsywJw3yHAsnDBrLT+4K/+zO/68GBLdx5vMC4eK20FRn1YAEbOh s4QQ== X-Gm-Message-State: AOAM533RIWhwpxwN/84ac3vlSqecFXAej8z/05AjThT1ez558CMWQnWO BzKYBBHCmRUT4hmmW5JH0Wg= X-Received: by 2002:a17:902:e846:b0:13f:551b:ba23 with SMTP id t6-20020a170902e84600b0013f551bba23mr14791681plg.77.1634365465100; Fri, 15 Oct 2021 23:24:25 -0700 (PDT) Received: from localhost.localdomain ([171.211.26.24]) by smtp.gmail.com with ESMTPSA id z11sm13147334pjl.45.2021.10.15.23.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 23:24:24 -0700 (PDT) From: DENG Qingfang To: Sean Wang , Landen Chao , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , Philipp Zabel , Russell King , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Subject: [PATCH net] net: dsa: mt7530: correct ds->num_ports Date: Sat, 16 Oct 2021 14:24:14 +0800 Message-Id: <20211016062414.783863-1-dqfext@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Setting ds->num_ports to DSA_MAX_PORTS made DSA core allocate unnecessary dsa_port's and call mt7530_port_disable for non-existent ports. Set it to MT7530_NUM_PORTS to fix that, and dsa_is_user_port check in port_enable/disable is no longer required. Cc: stable@vger.kernel.org Signed-off-by: DENG Qingfang --- drivers/net/dsa/mt7530.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index a3b49abd32f1..dbd15da977b5 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1035,9 +1035,6 @@ mt7530_port_enable(struct dsa_switch *ds, int port, { struct mt7530_priv *priv = ds->priv; - if (!dsa_is_user_port(ds, port)) - return 0; - mutex_lock(&priv->reg_mutex); /* Allow the user port gets connected to the cpu port and also @@ -1060,9 +1057,6 @@ mt7530_port_disable(struct dsa_switch *ds, int port) { struct mt7530_priv *priv = ds->priv; - if (!dsa_is_user_port(ds, port)) - return; - mutex_lock(&priv->reg_mutex); /* Clear up all port matrix which could be restored in the next @@ -3265,7 +3259,7 @@ mt7530_probe(struct mdio_device *mdiodev) return -ENOMEM; priv->ds->dev = &mdiodev->dev; - priv->ds->num_ports = DSA_MAX_PORTS; + priv->ds->num_ports = MT7530_NUM_PORTS; /* Use medatek,mcm property to distinguish hardware type that would * casues a little bit differences on power-on sequence. -- 2.25.1