* [PATCH] scsi: aic7xxx: Use kzalloc() instead of kmalloc()+memset()
@ 2020-04-03 16:36 Alex Dewar
2020-04-24 16:49 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Alex Dewar @ 2020-04-03 16:36 UTC (permalink / raw)
To: alex.dewar
Cc: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel
There are a couple of places where kzalloc() could be used directly
instead of calling kmalloc() then memset(). Replace them.
Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
---
drivers/scsi/aic7xxx/aic79xx_core.c | 3 +--
drivers/scsi/aic7xxx/aic7xxx_core.c | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index a336a458c978..c38163707259 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -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);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 84fc499cb1e6..36a7ea1ba7da 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -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);
--
2.26.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: aic7xxx: Use kzalloc() instead of kmalloc()+memset()
2020-04-03 16:36 [PATCH] scsi: aic7xxx: Use kzalloc() instead of kmalloc()+memset() Alex Dewar
@ 2020-04-24 16:49 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2020-04-24 16:49 UTC (permalink / raw)
To: Alex Dewar
Cc: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel
Alex,
> There are a couple of places where kzalloc() could be used directly
> instead of calling kmalloc() then memset(). Replace them.
Applied to 5.8/scsi-queue, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-24 16:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 16:36 [PATCH] scsi: aic7xxx: Use kzalloc() instead of kmalloc()+memset() Alex Dewar
2020-04-24 16:49 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).