aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/most
diff options
context:
space:
mode:
authorAndrey Shvetsov <andrey.shvetsov@k2l.de>2016-10-25 17:44:19 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-27 15:12:08 +0200
commit1e80e19ce9c67b2fecce9068ad40d1e778faa58f (patch)
tree6ba97fa32517726a7a4f38742e31b28318a96f58 /drivers/staging/most
parentStaging: media: davinci_vpfe: fix indentation issue in vpfe_video.c (diff)
downloadlinux-dev-1e80e19ce9c67b2fecce9068ad40d1e778faa58f.tar.xz
linux-dev-1e80e19ce9c67b2fecce9068ad40d1e778faa58f.zip
staging: most: aim-networking: keep channels closed if ndo_open fails
This patch stops all started channels whenever the function most_nd_open returns an error. Additionally, it renames variable wait_res to ret for the consistency. Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r--drivers/staging/most/aim-network/networking.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c
index fe0d516cf506..ce1764cba5f0 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -181,7 +181,7 @@ static int most_nd_set_mac_address(struct net_device *dev, void *p)
static int most_nd_open(struct net_device *dev)
{
struct net_dev_context *nd = dev->ml_priv;
- long wait_res;
+ long ret;
netdev_info(dev, "open net device\n");
@@ -203,26 +203,30 @@ static int most_nd_open(struct net_device *dev)
return -EBUSY;
}
- nd->channels_opened = true;
- netif_wake_queue(dev);
-
- if (is_valid_ether_addr(dev->dev_addr))
- return 0;
-
- nd->iface->request_netinfo(nd->iface, nd->tx.ch_id);
- wait_res = wait_for_completion_interruptible_timeout(
- &nd->mac_compl, msecs_to_jiffies(5000));
- if (!wait_res) {
- netdev_err(dev, "mac timeout\n");
- return -EBUSY;
- }
+ if (!is_valid_ether_addr(dev->dev_addr)) {
+ nd->iface->request_netinfo(nd->iface, nd->tx.ch_id);
+ ret = wait_for_completion_interruptible_timeout(
+ &nd->mac_compl, msecs_to_jiffies(5000));
+ if (!ret) {
+ netdev_err(dev, "mac timeout\n");
+ ret = -EBUSY;
+ goto err;
+ }
- if (wait_res < 0) {
- netdev_warn(dev, "mac waiting interrupted\n");
- return wait_res;
+ if (ret < 0) {
+ netdev_warn(dev, "mac waiting interrupted\n");
+ goto err;
+ }
}
+ nd->channels_opened = true;
+ netif_wake_queue(dev);
return 0;
+
+err:
+ most_stop_channel(nd->iface, nd->tx.ch_id, &aim);
+ most_stop_channel(nd->iface, nd->rx.ch_id, &aim);
+ return ret;
}
static int most_nd_stop(struct net_device *dev)