From patchwork Mon Aug 17 15:14:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 247865 Delivered-To: patch@linaro.org Received: by 2002:a54:3b12:0:0:0:0:0 with SMTP id j18csp2586910ect; Mon, 17 Aug 2020 12:28:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysM2i6ON8tLoEp1b5McaasDdlGLXpjHn3nvJ4dz9+5jbt4N1tAbxVfBXwTaHLkglpft8Q4 X-Received: by 2002:a17:906:600f:: with SMTP id o15mr16202966ejj.529.1597692506857; Mon, 17 Aug 2020 12:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597692506; cv=none; d=google.com; s=arc-20160816; b=rIC95K/rdA5Oc3Xk6X51ElOg2a2Q/5RpODlukFjug/FJkJRj4DNzIKV91ls4I6bBI6 tKb2Bw3MMmE1JzOaqFB5c/a9oh1MAL17nILwrnD3s7a5w7cnddC4YKjqOb3bCO+GXo1R eQoYvRNZoh2uWwQYGNW3kHuF4nVuQ5F12hWuOiwEehB4N6m50xCd8ReIgtTSjFnxkCy7 HX0wlyshKUTKy79Xl7RhsMik5p8wGRnr5s4U0XJ288+57AFde8paBz0aZ6nV0YqXZJLO VREHpA6/NRpQeoTSthRzSeeNAigWZoRtG6nZtZTxL02/JmnYd7Zf6WUBvbtFzSwSrdl1 CVmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=20cAmBEYR3eYbs2JwobYz+qj7hZJynIXBAnRos5zTqU=; b=zeUULJmOkokcUmUURbG7BOpgiWwFUkYzkljlrWxw/SlDdF/mjHp1G+1p33lFWVAbfh OlOlSjj2dH5qUVH9r8dXzlEolXJX4wd07JnPcBf3Bop9/wMlLhYa1Q7w5jidw3O3g+0x LqrjY184jgpr0jphgISuvQR3Kw6mHj2qY6l0HQNreeL+D0v2KrkmDEfl2WSf8krgzZvj 0nyOhIuUR0z3xrjzNZVYfTVcjAw2N3cDz2VKJ0D6jtxcgJBYneOJRPAxHSFhlGyq4lkH hhSeKMwAcLxJ/e1vJWOpRJ47ffe4got5gIfcOIDHsZLVIp7ZDoPRdF8SUy63c4dNWYiZ k9Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DzZLt4MT; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si11833514ejf.52.2020.08.17.12.28.26; Mon, 17 Aug 2020 12:28:26 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@kernel.org header.s=default header.b=DzZLt4MT; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731963AbgHQT2M (ORCPT + 15 others); Mon, 17 Aug 2020 15:28:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:33630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730337AbgHQPc4 (ORCPT ); Mon, 17 Aug 2020 11:32:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E48212311A; Mon, 17 Aug 2020 15:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678375; bh=QA7MIVp4ltQuVqhOplQfMzK4I4rRnM8iHhKZ0h1fVZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DzZLt4MTWywNP4aPXajDuLSW9MTEH52V1OE4L+1F1YXAW9cY/YNWWi+igWzSld1h6 OY6b+aUilcgVM18oo9nfPsiDp2DTCgyDUzMmHe0hPJ1aGqMZrGbLFMi/QwEWAhDjjn 41LRBEUelOBTtmipXD+D01XgDZy0SWU+XlZT/xxg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, DENG Qingfang , Mauri Sandberg , Florian Fainelli , Linus Walleij , "David S. Miller" , Sasha Levin Subject: [PATCH 5.8 312/464] net: dsa: rtl8366: Fix VLAN set-up Date: Mon, 17 Aug 2020 17:14:25 +0200 Message-Id: <20200817143848.742084268@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit 788abc6d9d278ed6fa1fa94db2098481a04152b7 ] Alter the rtl8366_vlan_add() to call rtl8366_set_vlan() inside the loop that goes over all VIDs since we now properly support calling that function more than once. Augment the loop to postincrement as this is more intuitive. The loop moved past the last VID but called rtl8366_set_vlan() with the port number instead of the VID, assuming a 1-to-1 correspondence between ports and VIDs. This was also a bug. Cc: DENG Qingfang Cc: Mauri Sandberg Reviewed-by: Florian Fainelli Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Signed-off-by: Linus Walleij Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/dsa/rtl8366.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index a75dcd6698b8a..1368816abaed1 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -397,7 +397,7 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) dev_err(smi->dev, "port is DSA or CPU port\n"); - for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { + for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { int pvid_val = 0; dev_info(smi->dev, "add VLAN %04x\n", vid); @@ -420,13 +420,13 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, if (ret < 0) return; } - } - ret = rtl8366_set_vlan(smi, port, member, untag, 0); - if (ret) - dev_err(smi->dev, - "failed to set up VLAN %04x", - vid); + ret = rtl8366_set_vlan(smi, vid, member, untag, 0); + if (ret) + dev_err(smi->dev, + "failed to set up VLAN %04x", + vid); + } } EXPORT_SYMBOL_GPL(rtl8366_vlan_add);