linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [SCSI] aic79xx: use kmemdup
@ 2016-05-19 14:08 Muhammad Falak R Wani
  2016-05-19 14:08 ` [PATCH] [SCSI] aic7xxx: " Muhammad Falak R Wani
  2016-05-19 14:08 ` [PATCH] [SCSI] aacraid: " Muhammad Falak R Wani
  0 siblings, 2 replies; 5+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-19 14:08 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel

Use kmemdup when some other buffer is immediately copied into allocated
region. It replaces call to allocation followed by memcpy, by a single
call to kmemdup.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
 drivers/scsi/aic7xxx/aic79xx_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 109e2c9..8592448 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -9494,10 +9494,10 @@ ahd_loadseq(struct ahd_softc *ahd)
 	if (cs_count != 0) {
 
 		cs_count *= sizeof(struct cs);
-		ahd->critical_sections = kmalloc(cs_count, GFP_ATOMIC);
+		ahd->critical_sections = kmemdup(cs_table, cs_count,
+						 GFP_ATOMIC);
 		if (ahd->critical_sections == NULL)
 			panic("ahd_loadseq: Could not malloc");
-		memcpy(ahd->critical_sections, cs_table, cs_count);
 	}
 	ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-01  2:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-19 14:08 [PATCH] [SCSI] aic79xx: use kmemdup Muhammad Falak R Wani
2016-05-19 14:08 ` [PATCH] [SCSI] aic7xxx: " Muhammad Falak R Wani
2016-05-19 14:08 ` [PATCH] [SCSI] aacraid: " Muhammad Falak R Wani
2016-05-19 18:25   ` Raghava Aditya Renukunta
2016-06-01  2:24   ` 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).