From patchwork Fri Aug 7 07:59:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 6966291 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DD9749F358 for ; Fri, 7 Aug 2015 08:11:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 200CF2064B for ; Fri, 7 Aug 2015 08:11:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D7BC20641 for ; Fri, 7 Aug 2015 08:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751869AbbHGILD (ORCPT ); Fri, 7 Aug 2015 04:11:03 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:21615 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422633AbbHGIAl (ORCPT ); Fri, 7 Aug 2015 04:00:41 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NSP0024TCX3QD40@mailout1.w1.samsung.com>; Fri, 07 Aug 2015 09:00:39 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-8f-55c465a796fc Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 16.94.04846.7A564C55; Fri, 7 Aug 2015 09:00:39 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NSP0013BCW67E10@eusync2.samsung.com>; Fri, 07 Aug 2015 09:00:39 +0100 (BST) From: Andrzej Hajda To: Hannes Reinecke Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , linux-kernel@vger.kernel.org, "James E.J. Bottomley" , linux-scsi@vger.kernel.org Subject: [PATCH 18/31] scsi/aic7xxx: use kmemdup rather than duplicating its implementation Date: Fri, 07 Aug 2015 09:59:24 +0200 Message-id: <1438934377-4922-19-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> References: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Fd3lqUdCDc4v0bG4te4cq8XGGetZ LRa82ctm8X/9bRaLy7vmsFl0X9/BZrH2yF12B3aPwz9+MHv0bVnF6LF+y1UWj8+b5AJYorhs UlJzMstSi/TtErgyNvxVKdjHW/G/5ShzA+Nu7i5GTg4JAROJ569eMEPYYhIX7q1nA7GFBJYy Skw+XtzFyAVkNzFJ9E/6zQiSYBPQlPi7+SZYkYiAssTr7mcsIEXMAj8YJV6deswKkhAWiJVo 7vwDNJWDg0VAVaL7lDNImFfAWWJj1z+oZXISJ49NBivnBIqv7J7JCrHYSeJN3wXmCYy8CxgZ VjGKppYmFxQnpeca6hUn5haX5qXrJefnbmKEBNKXHYyLj1kdYhTgYFTi4U34dzhUiDWxrLgy 9xCjBAezkgjvQ32gEG9KYmVValF+fFFpTmrxIUZpDhYlcd65u96HCAmkJ5akZqemFqQWwWSZ ODilGhjbWTJ2fg46GSV36BLDFMfQmKxS1jeTZlW9PRS1ULpyvYDc74UXHy5nEs4u1oj62jbf 9lf2ap7lrMKXZO2fG1jp/WY0FbyrOmnTi+CP849VW99UywrPOHVu+Stp7emz//39sWvZHH2u vJg/dz9n2a8M9FBfbftPMunpGYGG86LZwdUreB6ob/+ixFKckWioxVxUnAgAhv9mESACAAA= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);