Merge branch ‘cpsw-runtime-pm-fix’ [Linux 4.18]

This Linux kernel change "Merge branch ‘cpsw-runtime-pm-fix’" is included in the Linux 4.18 release. This change is authored by David S. Miller <davem [at] davemloft.net> on Sat Aug 11 09:38:53 2018 -0700. The commit for this change in Linux stable tree is 556fdd8 (patch). Other info about this change: Merge: e91e218 803c4f6

Merge branch 'cpsw-runtime-pm-fix'

Grygorii Strashko says:

====================
net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid

Here 2 not critical fixes for:
- vlan ale table leak while error if deleting vlan (simplifies next fix)
- runtime pm while try to set reserved vlan
====================

Reviewed-by: Grygorii Strashko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

There is no are 0 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 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 9edac67..3e34cb8 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;
 }

Leave a Reply

Your email address will not be published. Required fields are marked *