Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1202436

[PATCH 18/31] scsi/aic7xxx: use kmemdup rather than duplicating its implementation

From Andrzej Hajda <a.hajda@samsung.com>
Newsgroups linux.kernel
Subject [PATCH 18/31] scsi/aic7xxx: use kmemdup rather than duplicating its implementation
Date 2015-08-07 10:20 +0200
Message-ID <pUL2G-2d0-19@gated-at.bofh.it> (permalink)
References <pUKT0-21E-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/scsi/aic7xxx/aic79xx_core.c | 4 ++--
 drivers/scsi/aic7xxx/aic7xxx_core.c | 4 ++--
 2 files changed, 4 insertions(+), 4 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);
 
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index c4829d8..3178730 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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/31] use kmemdup rather than duplicating its implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:10 +0200
  [PATCH 31/31] sound/soc: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:10 +0200
  [PATCH 08/31] arch/x86/intel-mid: use kmemdup rather than duplicating  its implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:10 +0200
  [PATCH 25/31] fs/ubifs: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:10 +0200
    Re: [PATCH 25/31] fs/ubifs: use kmemdup rather than duplicating its implementation Richard Weinberger <richard.weinberger@gmail.com> - 2015-08-08 11:20 +0200
    Re: [PATCH 25/31] fs/ubifs: use kmemdup rather than duplicating its  implementation Artem Bityutskiy <dedekind1@gmail.com> - 2015-08-10 10:20 +0200
  [PATCH 03/31] arch/m68k/bootinfo: use kmemdup rather than duplicating  its implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
    Re: [PATCH 03/31] arch/m68k/bootinfo: use kmemdup rather than  duplicating its implementation Geert Uytterhoeven <geert@linux-m68k.org> - 2015-08-07 12:30 +0200
  [PATCH 06/31] arch/powerpc/pseries: use kmemdup rather than  duplicating its implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
    Re: [PATCH 06/31] arch/powerpc/pseries: use kmemdup rather than duplicating  its implementation Nathan Fontenot <nfont@linux.vnet.ibm.com> - 2015-08-07 21:50 +0200
  [PATCH 22/31] fs/ntfs: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
  [PATCH 04/31] arch/mips/bcm47xx: use kmemdup rather than duplicating  its implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
    Re: [PATCH 04/31] arch/mips/bcm47xx: use kmemdup rather than duplicating  its implementation Hauke Mehrtens <hauke@hauke-m.de> - 2015-08-09 22:20 +0200
  [PATCH 14/31] message/fusion: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
  [PATCH 12/31] drm/amdgpu: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
  [PATCH 15/31] misc/vmw_vmci: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
  [PATCH 17/31] scsi/aacraid: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
  [PATCH 18/31] scsi/aic7xxx: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
  [PATCH 05/31] arch/powerpc/nvram: use kmemdup rather than duplicating  its implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
    Re: [PATCH 05/31] arch/powerpc/nvram: use kmemdup rather than duplicating  its implementation Nathan Fontenot <nfont@linux.vnet.ibm.com> - 2015-08-07 21:50 +0200
  [PATCH 10/31] clk/mmp: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
    Re: [PATCH 10/31] clk/mmp: use kmemdup rather than duplicating its  implementation Stephen Boyd <sboyd@codeaurora.org> - 2015-08-08 00:20 +0200
  [PATCH 11/31] cpufreq/sfi: use kmemdup rather than duplicating its  implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:20 +0200
    Re: [PATCH 11/31] cpufreq/sfi: use kmemdup rather than duplicating  its implementation Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-07 11:00 +0200

csiph-web