From patchwork Thu May 19 14:08:31 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: 9127705 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 2911660467 for ; Thu, 19 May 2016 14:09:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B9B8281D9 for ; Thu, 19 May 2016 14:09:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99CDD281EA; Thu, 19 May 2016 14:09:38 +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 24D4B281F3 for ; Thu, 19 May 2016 14:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754665AbcESOIr (ORCPT ); Thu, 19 May 2016 10:08:47 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:33357 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754655AbcESOIq (ORCPT ); Thu, 19 May 2016 10:08:46 -0400 Received: by mail-pa0-f67.google.com with SMTP id gh9so8046407pac.0; Thu, 19 May 2016 07:08:45 -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; bh=AvSq0viyx3e/kl6sU7b+FY4I+hUmNoX/vMhokkuXZe8=; b=cECdSskrL4WGQ2M/mCNs26IqbeiR9eiVkNco3pOlJDTVFvr3ASleu6c4pvoFGxDeFA Gk0q6NMsrj2DXelBT9vqEpWsy7vPm5Kh+0kE5ttkIqmOXlzMNbi4Rm2EY3pzWe71jWyV QxSdBGTSmTUvDsvoI/lqdL+nRTwxUSf92HFuqBjx07dFOOjA1hnSjuKbtZ0g3GzAJMuz 5hpja+blRmbWLppQuX1pAuqO5Dd73hh0QmgmtrfBk5SVrvqEy5YXMkTrv6oAL81W+9rG 0c+jiS0Y3eCJhzqBbz88fIw15kE3aaA3XH5OuxNNb8aiD+RIEfIHU0M/dBGd99iGw/MK eU9w== 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; bh=AvSq0viyx3e/kl6sU7b+FY4I+hUmNoX/vMhokkuXZe8=; b=aedEk65Na/XL/m6zxuaVC2TqB0AFqBl9h3CQdJkRhVyrZs+yTc0b8TILKkm3wYWUF2 AC/PqHuUo7YbaaKAC678Dlbyh4DNUvBehcas4J4vWUWHtXQ2jFjZ6cLXP+mlnRJgTRPA B9wrytDcp1OuvO/wC+J724o0UnNHGgdUyON5nhTXMqoAiOsVyrTmvOjFgtQM+XUusnmT RU/kKVGU2Q9WiZJS0j0EZwQ+UQ+FYn5z3O22XFP/gzbc/eILGDHLTQL4AaSAxBQjy6oF 0gAIKm2SLZGwqxKCyFZ8ViP9Sf9gk+WWte1QV56iL/BNe2OJRPcsJzUFVoHbKjmSLlJX LXtQ== X-Gm-Message-State: AOPr4FUrQg0Iy3pkSt/dNTmfLv9ftFC5jB6f8IAtJJ58uZHT/iVMMIYoUuROPt2oVXc1NA== X-Received: by 10.66.117.201 with SMTP id kg9mr19966003pab.27.1463666925197; Thu, 19 May 2016 07:08:45 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 07:08:44 -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] aic79xx: use kmemdup Date: Thu, 19 May 2016 19:38:31 +0530 Message-Id: <1463666915-16906-1-git-send-email-falakreyaz@gmail.com> X-Mailer: git-send-email 1.9.1 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/aic79xx_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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);