Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[sfrench/cifs-2.6.git] / drivers / net / wireless / libertas / main.c
index 5d2bf539d4b92a87a2cdb48321795f37869a1330..4d4e2f3b66acbf8480722c5dfaafc70b93d491c5 100644 (file)
@@ -255,7 +255,7 @@ static int lbs_add_rtap(struct lbs_private *priv);
 static void lbs_remove_rtap(struct lbs_private *priv);
 static int lbs_add_mesh(struct lbs_private *priv);
 static void lbs_remove_mesh(struct lbs_private *priv);
-  
+
 
 /**
  * Get function for sysfs attribute rtap
@@ -347,7 +347,7 @@ static ssize_t lbs_mesh_set(struct device *dev,
        ret = lbs_mesh_config(priv, enable, priv->curbssparams.channel);
        if (ret)
                return ret;
-               
+
        if (enable)
                lbs_add_mesh(priv);
        else
@@ -388,6 +388,8 @@ static int lbs_dev_open(struct net_device *dev)
        struct lbs_private *priv = (struct lbs_private *) dev->priv ;
        int ret = 0;
 
+       lbs_deb_enter(LBS_DEB_NET);
+
        spin_lock_irq(&priv->driver_lock);
 
        if (priv->monitormode != LBS_MONITOR_OFF) {
@@ -401,7 +403,7 @@ static int lbs_dev_open(struct net_device *dev)
                netif_carrier_on(dev);
        } else {
                priv->infra_open = 1;
-               
+
                if (priv->connect_status == LBS_CONNECTED)
                        netif_carrier_on(dev);
                else
@@ -413,6 +415,7 @@ static int lbs_dev_open(struct net_device *dev)
  out:
 
        spin_unlock_irq(&priv->driver_lock);
+       lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
        return ret;
 }
 
@@ -426,6 +429,7 @@ static int lbs_mesh_stop(struct net_device *dev)
 {
        struct lbs_private *priv = (struct lbs_private *) (dev->priv);
 
+       lbs_deb_enter(LBS_DEB_MESH);
        spin_lock_irq(&priv->driver_lock);
 
        priv->mesh_open = 0;
@@ -433,8 +437,10 @@ static int lbs_mesh_stop(struct net_device *dev)
 
        netif_stop_queue(dev);
        netif_carrier_off(dev);
-       
+
        spin_unlock_irq(&priv->driver_lock);
+
+       lbs_deb_leave(LBS_DEB_MESH);
        return 0;
 }
 
@@ -448,13 +454,14 @@ static int lbs_eth_stop(struct net_device *dev)
 {
        struct lbs_private *priv = (struct lbs_private *) dev->priv;
 
-       spin_lock_irq(&priv->driver_lock);
+       lbs_deb_enter(LBS_DEB_NET);
 
+       spin_lock_irq(&priv->driver_lock);
        priv->infra_open = 0;
-
        netif_stop_queue(dev);
-       
        spin_unlock_irq(&priv->driver_lock);
+
+       lbs_deb_leave(LBS_DEB_NET);
        return 0;
 }
 
@@ -476,6 +483,13 @@ static void lbs_tx_timeout(struct net_device *dev)
           to kick it somehow? */
        lbs_host_to_card_done(priv);
 
+       /* More often than not, this actually happens because the
+          firmware has crapped itself -- rather than just a very
+          busy medium. So send a harmless command, and if/when
+          _that_ times out, we'll kick it in the head. */
+       lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
+                                    0, 0, NULL);
+
        lbs_deb_leave(LBS_DEB_TX);
 }
 
@@ -483,6 +497,8 @@ void lbs_host_to_card_done(struct lbs_private *priv)
 {
        unsigned long flags;
 
+       lbs_deb_enter(LBS_DEB_THREAD);
+
        spin_lock_irqsave(&priv->driver_lock, flags);
 
        priv->dnld_sent = DNLD_RES_RECEIVED;
@@ -492,6 +508,7 @@ void lbs_host_to_card_done(struct lbs_private *priv)
                wake_up_interruptible(&priv->waitq);
 
        spin_unlock_irqrestore(&priv->driver_lock, flags);
+       lbs_deb_leave(LBS_DEB_THREAD);
 }
 EXPORT_SYMBOL_GPL(lbs_host_to_card_done);
 
@@ -505,6 +522,7 @@ static struct net_device_stats *lbs_get_stats(struct net_device *dev)
 {
        struct lbs_private *priv = (struct lbs_private *) dev->priv;
 
+       lbs_deb_enter(LBS_DEB_NET);
        return &priv->stats;
 }
 
@@ -557,9 +575,7 @@ static int lbs_copy_multicast_address(struct lbs_private *priv,
                memcpy(&priv->multicastlist[i], mcptr->dmi_addr, ETH_ALEN);
                mcptr = mcptr->next;
        }
-
        return i;
-
 }
 
 static void lbs_set_multicast_list(struct net_device *dev)
@@ -613,7 +629,7 @@ static void lbs_set_multicast_list(struct net_device *dev)
                                       dev->mc_count);
 
                                for (i = 0; i < dev->mc_count; i++) {
-                                       lbs_deb_net("Multicast address %d:%s\n",
+                                       lbs_deb_net("Multicast address %d: %s\n",
                                               i, print_mac(mac,
                                               priv->multicastlist[i]));
                                }
@@ -662,12 +678,16 @@ static int lbs_thread(void *data)
                set_current_state(TASK_INTERRUPTIBLE);
                spin_lock_irq(&priv->driver_lock);
 
-               if (priv->surpriseremoved)
+               if (kthread_should_stop())
                        shouldsleep = 0;        /* Bye */
+               else if (priv->surpriseremoved)
+                       shouldsleep = 1;        /* We need to wait until we're _told_ to die */
                else if (priv->psstate == PS_STATE_SLEEP)
                        shouldsleep = 1;        /* Sleep mode. Nothing we can do till it wakes */
                else if (priv->intcounter)
                        shouldsleep = 0;        /* Interrupt pending. Deal with it now */
+               else if (priv->cmd_timed_out)
+                       shouldsleep = 0;        /* Command timed out. Recover */
                else if (!priv->fw_ready)
                        shouldsleep = 1;        /* Firmware not ready. We're waiting for it */
                else if (priv->dnld_sent)
@@ -699,12 +719,15 @@ static int lbs_thread(void *data)
                lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
                               priv->intcounter, priv->currenttxskb, priv->dnld_sent);
 
-               if (kthread_should_stop() || priv->surpriseremoved) {
-                       lbs_deb_thread("main-thread: break from main thread: surpriseremoved=0x%x\n",
-                                      priv->surpriseremoved);
+               if (kthread_should_stop()) {
+                       lbs_deb_thread("main-thread: break from main thread\n");
                        break;
                }
 
+               if (priv->surpriseremoved) {
+                       lbs_deb_thread("adapter removed; waiting to die...\n");
+                       continue;
+               }
 
                spin_lock_irq(&priv->driver_lock);
 
@@ -735,6 +758,26 @@ static int lbs_thread(void *data)
                        spin_lock_irq(&priv->driver_lock);
                }
 
+               if (priv->cmd_timed_out && priv->cur_cmd) {
+                       struct cmd_ctrl_node *cmdnode = priv->cur_cmd;
+
+                       if (++priv->nr_retries > 10) {
+                               lbs_pr_info("Excessive timeouts submitting command %x\n",
+                                           le16_to_cpu(cmdnode->cmdbuf->command));
+                               lbs_complete_command(priv, cmdnode, -ETIMEDOUT);
+                               priv->nr_retries = 0;
+                       } else {
+                               priv->cur_cmd = NULL;
+                               lbs_pr_info("requeueing command %x due to timeout (#%d)\n",
+                                           le16_to_cpu(cmdnode->cmdbuf->command), priv->nr_retries);
+
+                               /* Stick it back at the _top_ of the pending queue
+                                  for immediate resubmission */
+                               list_add(&cmdnode->list, &priv->cmdpendingq);
+                       }
+               }
+               priv->cmd_timed_out = 0;
+
                /* Any Card Event */
                if (priv->hisregcpy & MRVDRV_CARDEVENT) {
                        lbs_deb_thread("main-thread: Card Event Activity\n");
@@ -823,40 +866,45 @@ static int lbs_thread(void *data)
 static int lbs_suspend_callback(struct lbs_private *priv, unsigned long dummy,
                                struct cmd_header *cmd)
 {
-       lbs_deb_fw("HOST_SLEEP_ACTIVATE succeeded\n");
+       lbs_deb_enter(LBS_DEB_FW);
 
        netif_device_detach(priv->dev);
        if (priv->mesh_dev)
                netif_device_detach(priv->mesh_dev);
 
        priv->fw_ready = 0;
+       lbs_deb_leave(LBS_DEB_FW);
        return 0;
 }
 
-
 int lbs_suspend(struct lbs_private *priv)
 {
        struct cmd_header cmd;
        int ret;
 
+       lbs_deb_enter(LBS_DEB_FW);
+
        if (priv->wol_criteria == 0xffffffff) {
                lbs_pr_info("Suspend attempt without configuring wake params!\n");
                return -EINVAL;
        }
 
        memset(&cmd, 0, sizeof(cmd));
-       
+
        ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_ACTIVATE, &cmd,
                        sizeof(cmd), lbs_suspend_callback, 0);
        if (ret)
                lbs_pr_info("HOST_SLEEP_ACTIVATE failed: %d\n", ret);
 
+       lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
        return ret;
 }
 EXPORT_SYMBOL_GPL(lbs_suspend);
 
 int lbs_resume(struct lbs_private *priv)
 {
+       lbs_deb_enter(LBS_DEB_FW);
+
        priv->fw_ready = 1;
 
        /* Firmware doesn't seem to give us RX packets any more
@@ -868,6 +916,7 @@ int lbs_resume(struct lbs_private *priv)
        if (priv->mesh_dev)
                netif_device_attach(priv->mesh_dev);
 
+       lbs_deb_leave(LBS_DEB_FW);
        return 0;
 }
 EXPORT_SYMBOL_GPL(lbs_resume);
@@ -917,35 +966,23 @@ done:
 static void command_timer_fn(unsigned long data)
 {
        struct lbs_private *priv = (struct lbs_private *)data;
-       struct cmd_ctrl_node *node;
        unsigned long flags;
 
-       node = priv->cur_cmd;
-       if (node == NULL) {
-               lbs_deb_fw("ptempnode empty\n");
-               return;
-       }
+       lbs_deb_enter(LBS_DEB_CMD);
+       spin_lock_irqsave(&priv->driver_lock, flags);
 
-       if (!node->cmdbuf) {
-               lbs_deb_fw("cmd is NULL\n");
-               return;
+       if (!priv->cur_cmd) {
+               lbs_pr_info("Command timer expired; no pending command\n");
+               goto out;
        }
 
-       lbs_pr_info("command %x timed out\n", le16_to_cpu(node->cmdbuf->command));
-
-       if (!priv->fw_ready)
-               return;
-
-       spin_lock_irqsave(&priv->driver_lock, flags);
-       priv->cur_cmd = NULL;
-       spin_unlock_irqrestore(&priv->driver_lock, flags);
-
-       lbs_deb_fw("re-sending same command because of timeout\n");
-       lbs_queue_cmd(priv, node, 0);
+       lbs_pr_info("Command %x timed out\n", le16_to_cpu(priv->cur_cmd->cmdbuf->command));
 
+       priv->cmd_timed_out = 1;
        wake_up_interruptible(&priv->waitq);
-
-       return;
+out:
+       spin_unlock_irqrestore(&priv->driver_lock, flags);
+       lbs_deb_leave(LBS_DEB_CMD);
 }
 
 static int lbs_init_adapter(struct lbs_private *priv)
@@ -953,6 +990,8 @@ static int lbs_init_adapter(struct lbs_private *priv)
        size_t bufsize;
        int i, ret = 0;
 
+       lbs_deb_enter(LBS_DEB_MAIN);
+
        /* Allocate buffer to store the BSSID list */
        bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
        priv->networks = kzalloc(bufsize, GFP_KERNEL);
@@ -995,7 +1034,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
        mutex_init(&priv->lock);
 
        setup_timer(&priv->command_timer, command_timer_fn,
-                   (unsigned long)priv);
+               (unsigned long)priv);
 
        INIT_LIST_HEAD(&priv->cmdfreeq);
        INIT_LIST_HEAD(&priv->cmdpendingq);
@@ -1010,20 +1049,21 @@ static int lbs_init_adapter(struct lbs_private *priv)
        }
 
 out:
+       lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
+
        return ret;
 }
 
 static void lbs_free_adapter(struct lbs_private *priv)
 {
-       lbs_deb_fw("free command buffer\n");
-       lbs_free_cmd_buffer(priv);
+       lbs_deb_enter(LBS_DEB_MAIN);
 
-       lbs_deb_fw("free command_timer\n");
+       lbs_free_cmd_buffer(priv);
        del_timer(&priv->command_timer);
-
-       lbs_deb_fw("free scan results table\n");
        kfree(priv->networks);
        priv->networks = NULL;
+
+       lbs_deb_leave(LBS_DEB_MAIN);
 }
 
 /**
@@ -1038,7 +1078,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
        struct net_device *dev = NULL;
        struct lbs_private *priv = NULL;
 
-       lbs_deb_enter(LBS_DEB_NET);
+       lbs_deb_enter(LBS_DEB_MAIN);
 
        /* Allocate an Ethernet device and register it */
        dev = alloc_etherdev(sizeof(struct lbs_private));
@@ -1104,7 +1144,7 @@ err_init_adapter:
        priv = NULL;
 
 done:
-       lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv);
+       lbs_deb_leave_args(LBS_DEB_MAIN, "priv %p", priv);
        return priv;
 }
 EXPORT_SYMBOL_GPL(lbs_add_card);
@@ -1172,31 +1212,35 @@ int lbs_start_card(struct lbs_private *priv)
        if (device_create_file(&dev->dev, &dev_attr_lbs_rtap))
                lbs_pr_err("cannot register lbs_rtap attribute\n");
 
-       /* Enable mesh, if supported, and work out which TLV it uses.
-          0x100 + 291 is an unofficial value used in 5.110.20.pXX
-          0x100 + 37 is the official value used in 5.110.21.pXX
-          but we check them in that order because 20.pXX doesn't 
-          give an error -- it just silently fails. */
-
-       /* 5.110.20.pXX firmware will fail the command if the channel
-          doesn't match the existing channel. But only if the TLV
-          is correct. If the channel is wrong, _BOTH_ versions will
-          give an error to 0x100+291, and allow 0x100+37 to succeed.
-          It's just that 5.110.20.pXX will not have done anything
-          useful */
-
        lbs_update_channel(priv);
-       priv->mesh_tlv = 0x100 + 291;
-       if (lbs_mesh_config(priv, 1, priv->curbssparams.channel)) {
-               priv->mesh_tlv = 0x100 + 37;
-               if (lbs_mesh_config(priv, 1, priv->curbssparams.channel))
-                       priv->mesh_tlv = 0;
-       }
-       if (priv->mesh_tlv) {
-               lbs_add_mesh(priv);
 
-               if (device_create_file(&dev->dev, &dev_attr_lbs_mesh))
-                       lbs_pr_err("cannot register lbs_mesh attribute\n");
+       /* 5.0.16p0 is known to NOT support any mesh */
+       if (priv->fwrelease > 0x05001000) {
+               /* Enable mesh, if supported, and work out which TLV it uses.
+                  0x100 + 291 is an unofficial value used in 5.110.20.pXX
+                  0x100 + 37 is the official value used in 5.110.21.pXX
+                  but we check them in that order because 20.pXX doesn't
+                  give an error -- it just silently fails. */
+
+               /* 5.110.20.pXX firmware will fail the command if the channel
+                  doesn't match the existing channel. But only if the TLV
+                  is correct. If the channel is wrong, _BOTH_ versions will
+                  give an error to 0x100+291, and allow 0x100+37 to succeed.
+                  It's just that 5.110.20.pXX will not have done anything
+                  useful */
+
+               priv->mesh_tlv = 0x100 + 291;
+               if (lbs_mesh_config(priv, 1, priv->curbssparams.channel)) {
+                       priv->mesh_tlv = 0x100 + 37;
+                       if (lbs_mesh_config(priv, 1, priv->curbssparams.channel))
+                               priv->mesh_tlv = 0;
+               }
+               if (priv->mesh_tlv) {
+                       lbs_add_mesh(priv);
+
+                       if (device_create_file(&dev->dev, &dev_attr_lbs_mesh))
+                               lbs_pr_err("cannot register lbs_mesh attribute\n");
+               }
        }
 
        lbs_debugfs_init_one(priv, dev);
@@ -1232,6 +1276,7 @@ int lbs_stop_card(struct lbs_private *priv)
        /* Flush pending command nodes */
        spin_lock_irqsave(&priv->driver_lock, flags);
        list_for_each_entry(cmdnode, &priv->cmdpendingq, list) {
+               cmdnode->result = -ENOENT;
                cmdnode->cmdwaitqwoken = 1;
                wake_up_interruptible(&cmdnode->cmdwait_q);
        }
@@ -1306,35 +1351,25 @@ done:
        lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
        return ret;
 }
-EXPORT_SYMBOL_GPL(lbs_add_mesh);
-
 
 static void lbs_remove_mesh(struct lbs_private *priv)
 {
        struct net_device *mesh_dev;
 
-       lbs_deb_enter(LBS_DEB_MAIN);
-
-       if (!priv)
-               goto out;
 
        mesh_dev = priv->mesh_dev;
        if (!mesh_dev)
-               goto out;
+               return;
 
+       lbs_deb_enter(LBS_DEB_MESH);
        netif_stop_queue(mesh_dev);
        netif_carrier_off(priv->mesh_dev);
-
        sysfs_remove_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group);
        unregister_netdev(mesh_dev);
-
        priv->mesh_dev = NULL;
        free_netdev(mesh_dev);
-
-out:
-       lbs_deb_leave(LBS_DEB_MAIN);
+       lbs_deb_leave(LBS_DEB_MESH);
 }
-EXPORT_SYMBOL_GPL(lbs_remove_mesh);
 
 /**
  *  @brief This function finds the CFP in
@@ -1379,22 +1414,20 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band)
 
        memset(priv->region_channel, 0, sizeof(priv->region_channel));
 
-       {
-               cfp = lbs_get_region_cfp_table(region, band, &cfp_no);
-               if (cfp != NULL) {
-                       priv->region_channel[i].nrcfp = cfp_no;
-                       priv->region_channel[i].CFP = cfp;
-               } else {
-                       lbs_deb_main("wrong region code %#x in band B/G\n",
-                              region);
-                       ret = -1;
-                       goto out;
-               }
-               priv->region_channel[i].valid = 1;
-               priv->region_channel[i].region = region;
-               priv->region_channel[i].band = band;
-               i++;
+       cfp = lbs_get_region_cfp_table(region, band, &cfp_no);
+       if (cfp != NULL) {
+               priv->region_channel[i].nrcfp = cfp_no;
+               priv->region_channel[i].CFP = cfp;
+       } else {
+               lbs_deb_main("wrong region code %#x in band B/G\n",
+                      region);
+               ret = -1;
+               goto out;
        }
+       priv->region_channel[i].valid = 1;
+       priv->region_channel[i].region = region;
+       priv->region_channel[i].band = band;
+       i++;
 out:
        lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
        return ret;
@@ -1413,37 +1446,15 @@ void lbs_interrupt(struct lbs_private *priv)
        lbs_deb_enter(LBS_DEB_THREAD);
 
        lbs_deb_thread("lbs_interrupt: intcounter=%d\n", priv->intcounter);
-
-       if (!spin_is_locked(&priv->driver_lock)) {
-               printk(KERN_CRIT "%s called without driver_lock held\n", __func__);
-               WARN_ON(1);
-       }
-
        priv->intcounter++;
-
        if (priv->psstate == PS_STATE_SLEEP)
                priv->psstate = PS_STATE_AWAKE;
-
        wake_up_interruptible(&priv->waitq);
 
        lbs_deb_leave(LBS_DEB_THREAD);
 }
 EXPORT_SYMBOL_GPL(lbs_interrupt);
 
-int lbs_reset_device(struct lbs_private *priv)
-{
-       int ret;
-
-       lbs_deb_enter(LBS_DEB_MAIN);
-       ret = lbs_prepare_and_send_command(priv, CMD_802_11_RESET,
-                                   CMD_ACT_HALT, 0, 0, NULL);
-       msleep_interruptible(10);
-
-       lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
-       return ret;
-}
-EXPORT_SYMBOL_GPL(lbs_reset_device);
-
 static int __init lbs_init_module(void)
 {
        lbs_deb_enter(LBS_DEB_MAIN);
@@ -1455,9 +1466,7 @@ static int __init lbs_init_module(void)
 static void __exit lbs_exit_module(void)
 {
        lbs_deb_enter(LBS_DEB_MAIN);
-
        lbs_debugfs_remove();
-
        lbs_deb_leave(LBS_DEB_MAIN);
 }
 
@@ -1468,49 +1477,61 @@ static void __exit lbs_exit_module(void)
 static int lbs_rtap_open(struct net_device *dev)
 {
        /* Yes, _stop_ the queue. Because we don't support injection */
-        netif_carrier_off(dev);
-        netif_stop_queue(dev);
-        return 0;
+       lbs_deb_enter(LBS_DEB_MAIN);
+       netif_carrier_off(dev);
+       netif_stop_queue(dev);
+       lbs_deb_leave(LBS_DEB_LEAVE);
+       return 0;
 }
 
 static int lbs_rtap_stop(struct net_device *dev)
 {
-        return 0;
+       lbs_deb_enter(LBS_DEB_MAIN);
+       lbs_deb_leave(LBS_DEB_MAIN);
+       return 0;
 }
 
 static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-        netif_stop_queue(dev);
-        return NETDEV_TX_BUSY;
+       netif_stop_queue(dev);
+       return NETDEV_TX_BUSY;
 }
 
 static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev)
 {
        struct lbs_private *priv = dev->priv;
+       lbs_deb_enter(LBS_DEB_NET);
        return &priv->stats;
 }
 
 
 static void lbs_remove_rtap(struct lbs_private *priv)
 {
+       lbs_deb_enter(LBS_DEB_MAIN);
        if (priv->rtap_net_dev == NULL)
                return;
        unregister_netdev(priv->rtap_net_dev);
        free_netdev(priv->rtap_net_dev);
        priv->rtap_net_dev = NULL;
+       lbs_deb_leave(LBS_DEB_MAIN);
 }
 
 static int lbs_add_rtap(struct lbs_private *priv)
 {
-       int rc = 0;
+       int ret = 0;
        struct net_device *rtap_dev;
 
-       if (priv->rtap_net_dev)
-               return -EPERM;
+       lbs_deb_enter(LBS_DEB_MAIN);
+       if (priv->rtap_net_dev) {
+               ret = -EPERM;
+               goto out;
+       }
 
        rtap_dev = alloc_netdev(0, "rtap%d", ether_setup);
-       if (rtap_dev == NULL)
-               return -ENOMEM;
+       if (rtap_dev == NULL) {
+               ret = -ENOMEM;
+               goto out;
+       }
 
        memcpy(rtap_dev->dev_addr, priv->current_addr, ETH_ALEN);
        rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP;
@@ -1521,14 +1542,16 @@ static int lbs_add_rtap(struct lbs_private *priv)
        rtap_dev->set_multicast_list = lbs_set_multicast_list;
        rtap_dev->priv = priv;
 
-       rc = register_netdev(rtap_dev);
-       if (rc) {
+       ret = register_netdev(rtap_dev);
+       if (ret) {
                free_netdev(rtap_dev);
-               return rc;
+               goto out;
        }
        priv->rtap_net_dev = rtap_dev;
 
-       return 0;
+out:
+       lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
+       return ret;
 }