--- initial
+++ final
@@ -1,140 +1,139 @@
 dhd_pub_t *dhd_attach(struct dhd_bus *bus, uint bus_hdrlen) {
   dhd_info_t *dhd = NULL;
   struct net_device *net;
   DHD_TRACE(("%s: Enter\n", __func__));
   /* updates firmware nvram path if it was provided as module
            paramters */
   if ((firmware_path != NULL) && (firmware_path[0] != '\0')) strcpy(fw_path, firmware_path);
   if ((nvram_path != NULL) && (nvram_path[0] != '\0')) strcpy(nv_path, nvram_path);
   /* Allocate etherdev, including space for private structure */
   net = alloc_etherdev(sizeof(dhd));
   if (!net) {
     DHD_ERROR(("%s: OOM - alloc_etherdev\n", __func__));
     goto fail;
   }
   /* Allocate primary dhd_info */
-  dhd = kmalloc(sizeof(dhd_info_t), GFP_ATOMIC);
+  dhd = kzalloc(sizeof(dhd_info_t), GFP_ATOMIC);
   if (!dhd) {
     DHD_ERROR(("%s: OOM - alloc dhd_info\n", __func__));
     goto fail;
   }
-  memset(dhd, 0, sizeof(dhd_info_t));
   /*
    * Save the dhd_info into the priv
    */
   memcpy(netdev_priv(net), &dhd, sizeof(dhd));
   /* Set network interface name if it was provided as module parameter */
   if (iface_name[0]) {
     int len;
     char ch;
     strncpy(net->name, iface_name, IFNAMSIZ);
     net->name[IFNAMSIZ - 1] = 0;
     len = strlen(net->name);
     ch = net->name[len - 1];
     if ((ch > '9' || ch < '0') && (len < IFNAMSIZ - 2)) strcat(net->name, "%d");
   }
   if (dhd_add_if(dhd, 0, (void *)net, net->name, NULL, 0, 0) == DHD_BAD_IF) goto fail;
   net->netdev_ops = NULL;
   sema_init(&dhd->proto_sem, 1);
   /* Initialize other structure content */
   init_waitqueue_head(&dhd->ioctl_resp_wait);
   init_waitqueue_head(&dhd->ctrl_wait);
   /* Initialize the spinlocks */
   spin_lock_init(&dhd->sdlock);
   spin_lock_init(&dhd->txqlock);
   /* Link to info module */
   dhd->pub.info = dhd;
   /* Link to bus module */
   dhd->pub.bus = bus;
   dhd->pub.hdrlen = bus_hdrlen;
   /* Attach and link in the protocol */
   if (dhd_prot_attach(&dhd->pub) != 0) {
     DHD_ERROR(("dhd_prot_attach failed\n"));
     goto fail;
   }
 #if defined(CONFIG_WIRELESS_EXT)
   /* Attach and link in the iw */
   if (wl_iw_attach(net, (void *)&dhd->pub) != 0) {
     DHD_ERROR(("wl_iw_attach failed\n"));
     goto fail;
   }
 #endif /* defined(CONFIG_WIRELESS_EXT) */
   /* Attach and link in the cfg80211 */
   if (IS_CFG80211_FAVORITE()) {
     if (unlikely(wl_cfg80211_attach(net, &dhd->pub))) {
       DHD_ERROR(("wl_cfg80211_attach failed\n"));
       goto fail;
     }
     if (!NO_FW_REQ()) {
       strcpy(fw_path, wl_cfg80211_get_fwname());
       strcpy(nv_path, wl_cfg80211_get_nvramname());
     }
     wl_cfg80211_dbg_level(DBG_CFG80211_GET());
   }
   /* Set up the watchdog timer */
   init_timer(&dhd->timer);
   dhd->timer.data = (unsigned long)dhd;
   dhd->timer.function = dhd_watchdog;
   /* Initialize thread based operation and lock */
   sema_init(&dhd->sdsem, 1);
   if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0))
     dhd->threads_only = true;
   else
     dhd->threads_only = false;
   if (dhd_dpc_prio >= 0) {
     /* Initialize watchdog thread */
     sema_init(&dhd->watchdog_sem, 0);
     dhd->watchdog_tsk = kthread_run(dhd_watchdog_thread, dhd, "dhd_watchdog");
     if (IS_ERR(dhd->watchdog_tsk)) {
       printk(KERN_WARNING "dhd_watchdog thread failed to start\n");
       dhd->watchdog_tsk = NULL;
     }
   } else {
     dhd->watchdog_tsk = NULL;
   }
   /* Set up the bottom half handler */
   if (dhd_dpc_prio >= 0) {
     /* Initialize DPC thread */
     sema_init(&dhd->dpc_sem, 0);
     dhd->dpc_tsk = kthread_run(dhd_dpc_thread, dhd, "dhd_dpc");
     if (IS_ERR(dhd->dpc_tsk)) {
       printk(KERN_WARNING "dhd_dpc thread failed to start\n");
       dhd->dpc_tsk = NULL;
     }
   } else {
     tasklet_init(&dhd->tasklet, dhd_dpc, (unsigned long)dhd);
     dhd->dpc_tsk = NULL;
   }
   if (dhd_sysioc) {
     sema_init(&dhd->sysioc_sem, 0);
     dhd->sysioc_tsk = kthread_run(_dhd_sysioc_thread, dhd, "_dhd_sysioc");
     if (IS_ERR(dhd->sysioc_tsk)) {
       printk(KERN_WARNING "_dhd_sysioc thread failed to start\n");
       dhd->sysioc_tsk = NULL;
     }
   } else
     dhd->sysioc_tsk = NULL;
   /*
    * Save the dhd_info into the priv
    */
   memcpy(netdev_priv(net), &dhd, sizeof(dhd));
 #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
   g_bus = bus;
 #endif
 #if defined(CONFIG_PM_SLEEP)
   register_pm_notifier(&dhd_sleep_pm_notifier);
 #endif /* defined(CONFIG_PM_SLEEP) */
        /* && defined(DHD_GPL) */
        /* Init lock suspend to prevent kernel going to suspend */
 #ifdef CONFIG_HAS_EARLYSUSPEND
   dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20;
   dhd->early_suspend.suspend = dhd_early_suspend;
   dhd->early_suspend.resume = dhd_late_resume;
   register_early_suspend(&dhd->early_suspend);
 #endif
   return &dhd->pub;
 fail:
   if (net) free_netdev(net);
   if (dhd) dhd_detach(&dhd->pub);
   return NULL;
 }<sep>@@
expression e1,e2,e3;
identifier print1,print2;
constant char[] c1;
constant char[] c2;
statement S;
@@

-       e3 = kmalloc(e1, e2)
+       e3 = kzalloc(e1, e2)
        <... when != e3
(
	print1(...,c1,...,e3,...);
|
	kfree(e3);
)
       ...>
        if (e3 == NULL || ...) S
        <... when != e3
(
	print2(...,c2,...,e3,...);
|
	kfree(e3);
)
        ...>
-       memset(e3, 0, e1);