From patchwork Wed Dec 28 11:00:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Gurtovoy X-Patchwork-Id: 9490157 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 E644262AB8 for ; Wed, 28 Dec 2016 11:00:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D042A1FE82 for ; Wed, 28 Dec 2016 11:00:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2B9926247; Wed, 28 Dec 2016 11:00:24 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 6C35F2623D for ; Wed, 28 Dec 2016 11:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751317AbcL1LAW (ORCPT ); Wed, 28 Dec 2016 06:00:22 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:45995 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751316AbcL1LAV (ORCPT ); Wed, 28 Dec 2016 06:00:21 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from maxg@mellanox.com) with ESMTPS (AES256-SHA encrypted); 28 Dec 2016 13:00:14 +0200 Received: from r-vnc08.mtr.labs.mlnx (r-vnc08.mtr.labs.mlnx [10.208.0.121]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id uBSB0D12004611; Wed, 28 Dec 2016 13:00:13 +0200 From: Max Gurtovoy To: bvanassche@acm.org, linux-rdma@vger.kernel.org Cc: israelr@mellanox.com, Max Gurtovoy Subject: [PATCH 2/3] IB/srpt: allocate ib_qp_attr on the stack Date: Wed, 28 Dec 2016 13:00:12 +0200 Message-Id: <1482922813-8392-3-git-send-email-maxg@mellanox.com> X-Mailer: git-send-email 1.7.8.2 In-Reply-To: <1482922813-8392-1-git-send-email-maxg@mellanox.com> References: <1482922813-8392-1-git-send-email-maxg@mellanox.com> 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 No reason to allocate it dynamically. Signed-off-by: Max Gurtovoy Reviewed-by: Yuval Shaia --- drivers/infiniband/ulp/srpt/ib_srpt.c | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 0b1f69e..aa18d74 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -984,24 +984,20 @@ static int srpt_get_desc_tbl(struct srpt_send_ioctx *ioctx, */ static int srpt_init_ch_qp(struct srpt_rdma_ch *ch, struct ib_qp *qp) { - struct ib_qp_attr *attr; + struct ib_qp_attr attr; int ret; - attr = kzalloc(sizeof(*attr), GFP_KERNEL); - if (!attr) - return -ENOMEM; - - attr->qp_state = IB_QPS_INIT; - attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_READ | + memset(&attr, 0, sizeof(attr)); + attr.qp_state = IB_QPS_INIT; + attr.qp_access_flags = IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_READ | IB_ACCESS_REMOTE_WRITE; - attr->port_num = ch->sport->port; - attr->pkey_index = 0; + attr.port_num = ch->sport->port; + attr.pkey_index = 0; - ret = ib_modify_qp(qp, attr, + ret = ib_modify_qp(qp, &attr, IB_QP_STATE | IB_QP_ACCESS_FLAGS | IB_QP_PORT | IB_QP_PKEY_INDEX); - kfree(attr); return ret; }