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 <falakre...@gmail.com>
---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c 
b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 64ab9ea..2672c39 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -6940,10 +6940,10 @@ ahc_loadseq(struct ahc_softc *ahc)
        if (cs_count != 0) {
 
                cs_count *= sizeof(struct cs);
-               ahc->critical_sections = kmalloc(cs_count, GFP_ATOMIC);
+               ahc->critical_sections = kmemdup(cs_table, cs_count,
+                                                GFP_ATOMIC);
                if (ahc->critical_sections == NULL)
                        panic("ahc_loadseq: Could not malloc");
-               memcpy(ahc->critical_sections, cs_table, cs_count);
        }
        ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS|FASTMODE);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to