net: ethernet: ti: cpsw: correct .ndo_open error path
authorIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Tue, 28 May 2019 17:45:19 +0000 (20:45 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 May 2019 04:50:14 +0000 (21:50 -0700)
It's found while review and probably never happens, but real number
of queues is set per device, and error path should be per device.
So split error path based on usage_count.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw.c

index 634fc484a0b373bf870352224f61f20c2241b272..6d3f1f3f90cb722f26115ba57d08aac09639c73c 100644 (file)
@@ -1423,8 +1423,11 @@ static int cpsw_ndo_open(struct net_device *ndev)
        return 0;
 
 err_cleanup:
-       cpdma_ctlr_stop(cpsw->dma);
-       for_each_slave(priv, cpsw_slave_stop, cpsw);
+       if (!cpsw->usage_count) {
+               cpdma_ctlr_stop(cpsw->dma);
+               for_each_slave(priv, cpsw_slave_stop, cpsw);
+       }
+
        pm_runtime_put_sync(cpsw->dev);
        netif_carrier_off(priv->ndev);
        return ret;