From patchwork Mon Oct 22 14:00:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen X-Patchwork-Id: 10652171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4EB7514E2 for ; Mon, 22 Oct 2018 14:00:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AC8328998 for ; Mon, 22 Oct 2018 14:00:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E9B5289A3; Mon, 22 Oct 2018 14:00:53 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 28BF328998 for ; Mon, 22 Oct 2018 14:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728050AbeJVWTe (ORCPT ); Mon, 22 Oct 2018 18:19:34 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:43112 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbeJVWTe (ORCPT ); Mon, 22 Oct 2018 18:19:34 -0400 Received: by mail-pg1-f194.google.com with SMTP id d8-v6so7852476pgv.10 for ; Mon, 22 Oct 2018 07:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bD/cpMS7kRBdp6RCrl11pKbIPGHB8YnIfTA6145dDeM=; b=A8mBjAYpLb71TQW6xNMseoFEGJaml8MLadw0XZ6Nsg42Lk2KGC9lC4hRIuCziTQKC0 hMvIjxKIxymYlqjzcg+aa5M74OLpPjU0t9KP6jmpFCiusbI15mTAV/h3ijlzsgXgWS/1 SbiB27U3SGVItfPJImSRn8dHf29CkkefTJ27siNDDwKpxf5Xo7pKcCn6g2sZGqZUJRCX NzA+fhDJhFk50WTGHQoI8X2vDxezkShhvYri8yhMt2cpzUdye2KbFfIFbPg/Rq3pOGIQ nITMeUnfSJUD6CKiZpciARO/LERxlWkf3IwiNW8jLLGpgPAxYb1GOoI6SIdxbNuZd9qT tgjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bD/cpMS7kRBdp6RCrl11pKbIPGHB8YnIfTA6145dDeM=; b=otkHtGZkLTsie6Q2t2J840pWGCQg9p/kXMoYJefFxfKPWVrm5T07iinJO1S017WORv kWHNFwVldx609a9JLU0VK8D1ewgUXfaxJHbIQv2xprd8gAZzTolB3Aj66GseCJyzxB7q QcUzKJDB+7KXf0FvoLWbTTMdDdoS6/7O3LxNq8VjUo6TbMiqTiRWqjxYA0SMOor0lohY 4P5SQ8SqNiup3hNv7moGoRW85EB1Y3wXzFMhq/sdfY3abj6Y51UXenXjch60mfzyvjWh X3uoHx8wrR+gv518byf+DKEDNhW/MJDwulrQn4sFi/ARHlxjGAS2W95ZbJhbf5Mdfz/v mfWg== X-Gm-Message-State: ABuFfoiHNbSBJ3jL9jdONNc+Of3bAHe0nk1zUPzxn9GWI8ycFkeDxu9A 3MgMUWTHw0lBK5AX9DTILmE= X-Google-Smtp-Source: ACcGV63+JKQX0eIMt9GIwkie5Q8hstXRsjXo0zlTsHc5K9A0r9lzuys+ke0ChhLRyL+V6Ls7K925CA== X-Received: by 2002:a65:4cc3:: with SMTP id n3-v6mr43906811pgt.257.1540216850838; Mon, 22 Oct 2018 07:00:50 -0700 (PDT) Received: from localhost.localdomain ([103.42.74.200]) by smtp.gmail.com with ESMTPSA id e22-v6sm34456744pfi.61.2018.10.22.07.00.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Oct 2018 07:00:49 -0700 (PDT) From: Allen Pais To: oulijun@huawei.com Cc: xavier.huwei@huawei.com, linux-rdma@vger.kernel.org, Allen Pais , Allen Pais Subject: [PATCH] RDMA/hns:use dma_zalloc_coherent to replace dma_alloc_coherent and memset. Date: Mon, 22 Oct 2018 19:30:43 +0530 Message-Id: <1540216843-14118-1-git-send-email-allen.lkml@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Allen Pais Signed-off-by: Allen Pais --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 0218c0f..0a35870 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -4816,13 +4816,12 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, eqe_alloc = i * (buf_chk_sz / eq->eqe_size); size = (eq->entries - eqe_alloc) * eq->eqe_size; } - eq->buf[i] = dma_alloc_coherent(dev, size, + eq->buf[i] = dma_zalloc_coherent(dev, size, &(eq->buf_dma[i]), GFP_KERNEL); if (!eq->buf[i]) goto err_dma_alloc_buf; - memset(eq->buf[i], 0, size); *(eq->bt_l0 + i) = eq->buf_dma[i]; eq_buf_cnt++; @@ -4852,13 +4851,12 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, size = (eq->entries - eqe_alloc) * eq->eqe_size; } - eq->buf[idx] = dma_alloc_coherent(dev, size, + eq->buf[idx] = dma_zalloc_coherent(dev, size, &(eq->buf_dma[idx]), GFP_KERNEL); if (!eq->buf[idx]) goto err_dma_alloc_buf; - memset(eq->buf[idx], 0, size); *(eq->bt_l1[i] + j) = eq->buf_dma[idx]; eq_buf_cnt++; @@ -4968,7 +4966,7 @@ static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev, goto free_cmd_mbox; } - eq->buf_list->buf = dma_alloc_coherent(dev, buf_chk_sz, + eq->buf_list->buf = dma_zalloc_coherent(dev, buf_chk_sz, &(eq->buf_list->map), GFP_KERNEL); if (!eq->buf_list->buf) { @@ -4976,7 +4974,6 @@ static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev, goto err_alloc_buf; } - memset(eq->buf_list->buf, 0, buf_chk_sz); } else { ret = hns_roce_mhop_alloc_eq(hr_dev, eq); if (ret) {