]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
scsi: aic7xxx: Use kzalloc() instead of kmalloc()+memset()
authorAlex Dewar <alex.dewar@gmx.co.uk>
Fri, 3 Apr 2020 16:36:10 +0000 (17:36 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 24 Apr 2020 16:48:06 +0000 (12:48 -0400)
There are a couple of places where kzalloc() could be used directly instead
of calling kmalloc() then memset(). Replace them.

Link: https://lore.kernel.org/r/20200403163611.46756-1-alex.dewar@gmx.co.uk
Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/aic7xxx/aic79xx_core.c
drivers/scsi/aic7xxx/aic7xxx_core.c

index a336a458c9783cb507052debe9bbfeab9d69a994..c38163707259c30abb96b1ec16a1fa846442f567 100644 (file)
@@ -6054,14 +6054,13 @@ ahd_alloc(void *platform_arg, char *name)
 {
        struct  ahd_softc *ahd;
 
-       ahd = kmalloc(sizeof(*ahd), GFP_ATOMIC);
+       ahd = kzalloc(sizeof(*ahd), GFP_ATOMIC);
        if (!ahd) {
                printk("aic7xxx: cannot malloc softc!\n");
                kfree(name);
                return NULL;
        }
 
-       memset(ahd, 0, sizeof(*ahd));
        ahd->seep_config = kmalloc(sizeof(*ahd->seep_config), GFP_ATOMIC);
        if (ahd->seep_config == NULL) {
                kfree(ahd);
index 84fc499cb1e6d3f050a44458e0afadd2f0c89d03..36a7ea1ba7da0fff3100711d8038d27b7e439be8 100644 (file)
@@ -4384,13 +4384,13 @@ ahc_alloc(void *platform_arg, char *name)
        struct  ahc_softc *ahc;
        int     i;
 
-       ahc = kmalloc(sizeof(*ahc), GFP_ATOMIC);
+       ahc = kzalloc(sizeof(*ahc), GFP_ATOMIC);
        if (!ahc) {
                printk("aic7xxx: cannot malloc softc!\n");
                kfree(name);
                return NULL;
        }
-       memset(ahc, 0, sizeof(*ahc));
+
        ahc->seep_config = kmalloc(sizeof(*ahc->seep_config), GFP_ATOMIC);
        if (ahc->seep_config == NULL) {
                kfree(ahc);