Commit 9cd7d494 authored by Alex Dewar's avatar Alex Dewar Committed by Martin K. Petersen

scsi: aic7xxx: Use kzalloc() instead of kmalloc()+memset()

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.ukSigned-off-by: default avatarAlex Dewar <alex.dewar@gmx.co.uk>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f8e25f97
...@@ -6054,14 +6054,13 @@ ahd_alloc(void *platform_arg, char *name) ...@@ -6054,14 +6054,13 @@ ahd_alloc(void *platform_arg, char *name)
{ {
struct ahd_softc *ahd; struct ahd_softc *ahd;
ahd = kmalloc(sizeof(*ahd), GFP_ATOMIC); ahd = kzalloc(sizeof(*ahd), GFP_ATOMIC);
if (!ahd) { if (!ahd) {
printk("aic7xxx: cannot malloc softc!\n"); printk("aic7xxx: cannot malloc softc!\n");
kfree(name); kfree(name);
return NULL; return NULL;
} }
memset(ahd, 0, sizeof(*ahd));
ahd->seep_config = kmalloc(sizeof(*ahd->seep_config), GFP_ATOMIC); ahd->seep_config = kmalloc(sizeof(*ahd->seep_config), GFP_ATOMIC);
if (ahd->seep_config == NULL) { if (ahd->seep_config == NULL) {
kfree(ahd); kfree(ahd);
......
...@@ -4384,13 +4384,13 @@ ahc_alloc(void *platform_arg, char *name) ...@@ -4384,13 +4384,13 @@ ahc_alloc(void *platform_arg, char *name)
struct ahc_softc *ahc; struct ahc_softc *ahc;
int i; int i;
ahc = kmalloc(sizeof(*ahc), GFP_ATOMIC); ahc = kzalloc(sizeof(*ahc), GFP_ATOMIC);
if (!ahc) { if (!ahc) {
printk("aic7xxx: cannot malloc softc!\n"); printk("aic7xxx: cannot malloc softc!\n");
kfree(name); kfree(name);
return NULL; return NULL;
} }
memset(ahc, 0, sizeof(*ahc));
ahc->seep_config = kmalloc(sizeof(*ahc->seep_config), GFP_ATOMIC); ahc->seep_config = kmalloc(sizeof(*ahc->seep_config), GFP_ATOMIC);
if (ahc->seep_config == NULL) { if (ahc->seep_config == NULL) {
kfree(ahc); kfree(ahc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment