diff mbox

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

Message ID 1438934377-4922-19-git-send-email-a.hajda@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrzej Hajda Aug. 7, 2015, 7:59 a.m. UTC
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(-)

Comments

Andrzej Hajda Sept. 16, 2015, 10:02 a.m. UTC | #1
Ping.

Regards
Andrzej

On 08/07/2015 09:59 AM, Andrzej Hajda wrote:
> 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);
>  

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

Patch

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);