All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@nvidia.com>
Cc: Leon Romanovsky <leonro@nvidia.com>,
	Faisal Latif <faisal.latif@intel.com>,
	linux-rdma@vger.kernel.org,
	Shiraz Saleem <shiraz.saleem@intel.com>
Subject: [PATCH rdma-next 10/10] RDMA/i40iw: Remove intermediate pointer that points to the same struct
Date: Thu, 10 Sep 2020 17:00:46 +0300	[thread overview]
Message-ID: <20200910140046.1306341-11-leon@kernel.org> (raw)
In-Reply-To: <20200910140046.1306341-1-leon@kernel.org>

From: Leon Romanovsky <leonro@nvidia.com>

There is no real need to have an intermediate pointer for the same
struct, remove it, and use struct directly.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 9 +++------
 drivers/infiniband/hw/i40iw/i40iw_verbs.h | 1 -
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 4511e175c498..f5d54cb46f78 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -380,7 +380,7 @@ void i40iw_free_qp_resources(struct i40iw_device *iwdev,
 	i40iw_free_dma_mem(iwdev->sc_dev.hw, &iwqp->kqp.dma_mem);
 	kfree(iwqp->kqp.wrid_mem);
 	iwqp->kqp.wrid_mem = NULL;
-	kfree(iwqp->allocated_buffer);
+	kfree(iwqp);
 }
 
 /**
@@ -525,7 +525,6 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd,
 	struct i40iw_create_qp_req req;
 	struct i40iw_create_qp_resp uresp;
 	u32 qp_num = 0;
-	void *mem;
 	enum i40iw_status_code ret;
 	int err_code;
 	int sq_size;
@@ -567,12 +566,10 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd,
 	init_info.qp_uk_init_info.max_rq_frag_cnt = init_attr->cap.max_recv_sge;
 	init_info.qp_uk_init_info.max_inline_data = init_attr->cap.max_inline_data;
 
-	mem = kzalloc(sizeof(*iwqp), GFP_KERNEL);
-	if (!mem)
+	iwqp = kzalloc(sizeof(*iwqp), GFP_KERNEL);
+	if (!iwqp)
 		return ERR_PTR(-ENOMEM);
 
-	iwqp = (struct i40iw_qp *)mem;
-	iwqp->allocated_buffer = mem;
 	qp = &iwqp->sc_qp;
 	qp->back_qp = (void *)iwqp;
 	qp->push_idx = I40IW_INVALID_PUSH_PAGE_INDEX;
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.h b/drivers/infiniband/hw/i40iw/i40iw_verbs.h
index 331bc21cbcc7..1bd790575bd4 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.h
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.h
@@ -138,7 +138,6 @@ struct i40iw_qp {
 	struct i40iw_pd *iwpd;
 	struct i40iw_qp_host_ctx_info ctx_info;
 	struct i40iwarp_offload_info iwarp_info;
-	void *allocated_buffer;
 	atomic_t refcount;
 	struct iw_cm_id *cm_id;
 	void *cm_node;
-- 
2.26.2


  parent reply	other threads:[~2020-09-10 21:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 14:00 [PATCH rdma-next 00/10] Prepare drivers to move QP allocation to ib_core Leon Romanovsky
2020-09-10 14:00 ` [PATCH rdma-next 01/10] RDMA/mlx5: Embed GSI QP into general mlx5_ib QP Leon Romanovsky
2020-09-10 14:00 ` [PATCH rdma-next 02/10] RDMA/mlx5: Reuse existing fields in parent QP storage object Leon Romanovsky
2020-09-10 14:00 ` [PATCH rdma-next 03/10] RDMA/mlx5: Change GSI QP to have same creation flow like other QPs Leon Romanovsky
2020-09-10 14:00 ` [PATCH rdma-next 04/10] RDMA/mlx5: Delete not needed GSI QP signature QP type Leon Romanovsky
2020-09-24 23:10   ` Jason Gunthorpe
2020-09-10 14:00 ` [PATCH rdma-next 05/10] RDMA/mlx4: Embed GSI QP into general mlx4_ib QP Leon Romanovsky
2020-09-10 14:00 ` [PATCH rdma-next 06/10] RDMA/mlx4: Prepare QP allocation to remove from the driver Leon Romanovsky
2020-09-10 14:00 ` [PATCH rdma-next 07/10] RDMA/core: Align write and ioctl checks of QP types Leon Romanovsky
2020-09-24 23:10   ` Jason Gunthorpe
2020-09-10 14:00 ` [PATCH rdma-next 08/10] RDMA/drivers: Remove udata check from special QP Leon Romanovsky
2020-09-24 23:11   ` Jason Gunthorpe
2020-09-10 14:00 ` [PATCH rdma-next 09/10] RDMA/mthca: Combine special QP struct with mthca QP Leon Romanovsky
2020-09-10 14:00 ` Leon Romanovsky [this message]
2020-09-10 14:30   ` [PATCH rdma-next 10/10] RDMA/i40iw: Remove intermediate pointer that points to the same struct Saleem, Shiraz
2020-09-24 23:09 ` [PATCH rdma-next 00/10] Prepare drivers to move QP allocation to ib_core Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200910140046.1306341-11-leon@kernel.org \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=faisal.latif@intel.com \
    --cc=jgg@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=shiraz.saleem@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.