Merge branch 'atmel'
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / atmel_cs.c
index 0c3301ef70ccd109432ad65b1617d02747061dc0..17d1fd90f832972c5ea374ca4084bf1405ccc391 100644 (file)
@@ -181,12 +181,11 @@ static dev_link_t *atmel_attach(void)
        DEBUG(0, "atmel_attach()\n");
 
        /* Initialize the dev_link_t structure */
-       link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
+       link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL);
        if (!link) {
                printk(KERN_ERR "atmel_cs: no memory for new device\n");
                return NULL;
        }
-       memset(link, 0, sizeof(struct dev_link_t));
        
        /* Interrupt setup */
        link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
@@ -205,13 +204,12 @@ static dev_link_t *atmel_attach(void)
        link->conf.IntType = INT_MEMORY_AND_IO;
        
        /* Allocate space for private device-specific data */
-       local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
+       local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
        if (!local) {
                printk(KERN_ERR "atmel_cs: no memory for new device\n");
                kfree (link);
                return NULL;
        }
-       memset(local, 0, sizeof(local_info_t));
        link->priv = local;
        
        /* Register with Card Services */
@@ -260,8 +258,7 @@ static void atmel_detach(dev_link_t *link)
 
        /* Unlink device structure, free pieces */
        *linkp = link->next;
-       if (link->priv)
-               kfree(link->priv);
+       kfree(link->priv);
        kfree(link);
 }