From patchwork Thu May 19 14:08:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Falak R Wani X-Patchwork-Id: 9127701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4156960467 for ; Thu, 19 May 2016 14:09:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 347C2267DE for ; Thu, 19 May 2016 14:09:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 295D2281B9; Thu, 19 May 2016 14:09:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7887267DE for ; Thu, 19 May 2016 14:09:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755137AbcESOI5 (ORCPT ); Thu, 19 May 2016 10:08:57 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:35068 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755110AbcESOIv (ORCPT ); Thu, 19 May 2016 10:08:51 -0400 Received: by mail-pa0-f66.google.com with SMTP id rw9so8037607pab.2; Thu, 19 May 2016 07:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9u2+69zspPwOWjHy8+k6vptfBaU2W+HYGYPg7FIIgkE=; b=zQZCMq49d3Ml99IYddp2dFAiEZjJdSYSkWXxUAvA0/f5yexJbp8coBRVWSJ5oWMqyq XRPof7bTm9Gy+bTZNxRWPaUOidkFEK8psKr6MmLNsP+zIwabDQ8faxFBhr58lL1X19R8 fPRv8ztbruEZIx2fKJp7W3yeNll0sqFTV1QFf7WuOHSy8m6Zup+DCcTY5FcYSdt2+RQI Kt1zq2mxTeynAE2g4UYtQntq6pwJAVPgvKNm0mF6CMYobX7NdPc+Npvululx8IZ51gvF wIkaLBQQkcACpgveGYjM1S5Qoe/YOAp662JaqdFlvJI4AGNNkNIguvnuOxfejLxqa1pa Bhew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9u2+69zspPwOWjHy8+k6vptfBaU2W+HYGYPg7FIIgkE=; b=Wo29aRvC5cVXn+Rr3dqnB+jWI/kkb96g+hJD7rAhFMqCNSEEdmXbOlnlZalaHi02O4 XowphBO6fdyIbWG9WJs5ZAIIjbY1WTFTCpxe7Uu6qoJyFZCHfMZcCcenPN5+YCz2l/EY i0w/UYl7pD2yVK3qivC8Q7vqToLgpoyhFhxY+hpgDNhZKj66QkLtS4QL8Z6m64X36vz0 woxZWPQfpzoMnD8Q15u7TbHtWN/K5oVpd1RXlsrIjevvrLsO2XZUpXkpXPoIZY19Zf8I 9g9TitxO8HawMCPt/bbyrHh1SJQGR+J2s7ldcJ1DG1+gWpj+pRQQG9xeMZVhDBzVTkUK pKCQ== X-Gm-Message-State: AOPr4FUjbbz33C3gbFBlTR+kI5pxQ6+ssMBY64WCLG/1QGP2HQZeI6U/gnNHdkpzWTq5dg== X-Received: by 10.66.6.35 with SMTP id x3mr20025935pax.135.1463666929531; Thu, 19 May 2016 07:08:49 -0700 (PDT) Received: from kp.domain.name ([110.235.28.83]) by smtp.gmail.com with ESMTPSA id ey12sm20317959pac.26.2016.05.19.07.08.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 07:08:48 -0700 (PDT) From: Muhammad Falak R Wani To: Hannes Reinecke Cc: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [SCSI] aic7xxx: use kmemdup Date: Thu, 19 May 2016 19:38:32 +0530 Message-Id: <1463666915-16906-2-git-send-email-falakreyaz@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1463666915-16906-1-git-send-email-falakreyaz@gmail.com> References: <1463666915-16906-1-git-send-email-falakreyaz@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);