From patchwork Fri Aug 10 12:47:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 10562661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFCB31390 for ; Fri, 10 Aug 2018 12:47:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFF432BA08 for ; Fri, 10 Aug 2018 12:47:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B40A22BA0C; Fri, 10 Aug 2018 12:47:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BD502BA08 for ; Fri, 10 Aug 2018 12:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728188AbeHJPRK (ORCPT ); Fri, 10 Aug 2018 11:17:10 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36442 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbeHJPRK (ORCPT ); Fri, 10 Aug 2018 11:17:10 -0400 Received: by mail-lj1-f193.google.com with SMTP id u7-v6so7103972lji.3 for ; Fri, 10 Aug 2018 05:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0/BAzsY3ygWwvCiEZ/10Pn/Lg/p2uPBAkEn1J4zXy7s=; b=elfy2KSglYDEJJxxOi/LXkMdCR5gy14vWgFCPrrD2WTXhDnvaUc1VJDFb0m6LYIODJ i63AlPUo3meeXB7hhfstAUfH6LFR25BNdJFVHeMzqBwAzFyY6bjS+cZEAOIwi7gvyQRV g0ZtlAxvALSeX2oqVwEh8x+KLpn64hiVpXNUk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0/BAzsY3ygWwvCiEZ/10Pn/Lg/p2uPBAkEn1J4zXy7s=; b=t7dJpHRM9rjxAJCbr7EtiLrK2fWweRZePdgOBkf5HJEdt+JsmbFGtMRbd7gciM71uF +3+59GTA0L1bu/dgvjPUBoiUanoAxqQzGhcLmiRvrOomzaqy9B7kl6J5Bo+g+72Do7ty d3xl5grYmpdiJcQJ985l1sdt2spQ9O/3MCeLM4WdQGL+Pm69YvyS2wCPDP9YHz6MW3md 9/9ouQhggYYu2QS7h+9aU5y3dmvqXFnRs4Mos6WiiJeh2GkGfCaIOJiBYiHtBM3OaWg9 Qqa7RJ0qL/ASS1wQQ9LCXoV8fjZdImuxx41W+wvx+et92sfzMqJy4JuLCxQ6ifYITnhp AftQ== X-Gm-Message-State: AOUpUlH0xbsx+j3THIskDOtyzi5tSc3AfeqQrLR4gDqGsTZf5agSJd3U tJW2KX1j353YWyJd2xrCSUG8mw== X-Google-Smtp-Source: AA+uWPy4nUa6KyEGWUGvlrXze3jkwirmAPKsARS+ANvFwdwU8ME/1u3CLQEyZN/QiS5US2giVg7GVQ== X-Received: by 2002:a2e:498:: with SMTP id a24-v6mr4875106ljf.27.1533905242306; Fri, 10 Aug 2018 05:47:22 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id 84-v6sm1626382lje.48.2018.08.10.05.47.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 05:47:21 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com, davem@davemloft.net Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH 2/2] net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan Date: Fri, 10 Aug 2018 15:47:09 +0300 Message-Id: <20180810124709.25089-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810124709.25089-1-ivan.khoronzhuk@linaro.org> References: <20180810124709.25089-1-ivan.khoronzhuk@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's exclusive with normal behaviour but if try to set vlan to one of the reserved values is made, the cpsw runtime pm is broken. Fixes: commit a6c5d14f5136 ("drivers: net: cpsw: ndev: fix accessing to suspended device") Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 9edac671f276..3e34cb8ac1d3 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2086,14 +2086,16 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, int i; for (i = 0; i < cpsw->data.slaves; i++) { - if (vid == cpsw->slaves[i].port_vlan) - return -EINVAL; + if (vid == cpsw->slaves[i].port_vlan) { + ret = -EINVAL; + goto err; + } } } dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); ret = cpsw_add_vlan_ale_entry(priv, vid); - +err: pm_runtime_put(cpsw->dev); return ret; } @@ -2119,7 +2121,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, for (i = 0; i < cpsw->data.slaves; i++) { if (vid == cpsw->slaves[i].port_vlan) - return -EINVAL; + goto err; } } @@ -2129,6 +2131,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, HOST_PORT_NUM, ALE_VLAN, vid); ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, 0, ALE_VLAN, vid); +err: pm_runtime_put(cpsw->dev); return ret; }