Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e80e19c authored by Andrey Shvetsov's avatar Andrey Shvetsov Committed by Greg Kroah-Hartman
Browse files

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: default avatarAndrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 54dc7ed3
Loading
Loading
Loading
Loading
+21 −17
Original line number Diff line number Diff line
@@ -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;

	if (!is_valid_ether_addr(dev->dev_addr)) {
		nd->iface->request_netinfo(nd->iface, nd->tx.ch_id);
	wait_res = wait_for_completion_interruptible_timeout(
		ret = wait_for_completion_interruptible_timeout(
			      &nd->mac_compl, msecs_to_jiffies(5000));
	if (!wait_res) {
		if (!ret) {
			netdev_err(dev, "mac timeout\n");
		return -EBUSY;
			ret = -EBUSY;
			goto err;
		}

	if (wait_res < 0) {
		if (ret < 0) {
			netdev_warn(dev, "mac waiting interrupted\n");
		return wait_res;
			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)