net: wireless: bcmdhd: Init locks in dhd_attach() at the beginning
authorAndrey Vagin <avagin@parallels.com>
Mon, 9 Jul 2012 17:46:55 +0000 (10:46 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Thu, 12 Jul 2012 17:45:49 +0000 (10:45 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcmdhd/dhd_linux.c

index 2f48cbba9979c6c3f1036804d6af1685701e46aa..1cee01dda4cace281744dc97cdbc6cf6b8c5d68c 100644 (file)
@@ -2644,17 +2644,8 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
                        strcat(net->name, "%d");
        }
 
-       if (dhd_add_if(dhd, 0, (void *)net, net->name, NULL, 0, 0) == DHD_BAD_IF)
-               goto fail;
-       dhd_state |= DHD_ATTACH_STATE_ADD_IF;
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31))
-       net->open = NULL;
-#else
-       net->netdev_ops = NULL;
-#endif
-
        sema_init(&dhd->proto_sem, 1);
+       sema_init(&dhd->sdsem, 1);
 
 #ifdef PROP_TXSTATUS
        spin_lock_init(&dhd->wlfc_spinlock);
@@ -2670,6 +2661,17 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
        spin_lock_init(&dhd->txqlock);
        spin_lock_init(&dhd->dhd_lock);
 
+
+       if (dhd_add_if(dhd, 0, (void *)net, net->name, NULL, 0, 0) == DHD_BAD_IF)
+               goto fail;
+       dhd_state |= DHD_ATTACH_STATE_ADD_IF;
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31))
+       net->open = NULL;
+#else
+       net->netdev_ops = NULL;
+#endif
+
        /* Initialize Wakelock stuff */
        spin_lock_init(&dhd->wakelock_spinlock);
        dhd->wakelock_counter = 0;
@@ -2722,7 +2724,6 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
 
 #ifdef DHDTHREAD
        /* Initialize thread based operation and lock */
-       sema_init(&dhd->sdsem, 1);
        if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0)) {
                dhd->threads_only = TRUE;
        }