All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shiraz Saleem <shiraz.saleem@intel.com>
To: dledford@redhat.com, jgg@nvidia.com
Cc: linux-rdma@vger.kernel.org,
	Shiraz Saleem <shiraz.saleem@intel.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH rdma-next v1] irdma: Use list_last_entry/list_first_entry
Date: Tue,  8 Jun 2021 16:14:16 -0500	[thread overview]
Message-ID: <20210608211415.680-1-shiraz.saleem@intel.com> (raw)

Use list_last_entry and list_first_entry instead of using prev and next
pointers.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
---
v0->v1: create patch on more recent git version

 drivers/infiniband/hw/irdma/puda.c  | 2 +-
 drivers/infiniband/hw/irdma/utils.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/irdma/puda.c b/drivers/infiniband/hw/irdma/puda.c
index 18057139817d..e09d3be90771 100644
--- a/drivers/infiniband/hw/irdma/puda.c
+++ b/drivers/infiniband/hw/irdma/puda.c
@@ -1419,7 +1419,7 @@ irdma_ieq_handle_partial(struct irdma_puda_rsrc *ieq, struct irdma_pfpdu *pfpdu,
 
 error:
 	while (!list_empty(&pbufl)) {
-		buf = (struct irdma_puda_buf *)(pbufl.prev);
+		buf = list_last_entry(&pbufl, struct irdma_puda_buf, list);
 		list_del(&buf->list);
 		list_add(&buf->list, rxlist);
 	}
diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c
index 8ce3535cdc21..81e590fb77b1 100644
--- a/drivers/infiniband/hw/irdma/utils.c
+++ b/drivers/infiniband/hw/irdma/utils.c
@@ -425,8 +425,8 @@ struct irdma_cqp_request *irdma_alloc_and_get_cqp_request(struct irdma_cqp *cqp,
 
 	spin_lock_irqsave(&cqp->req_lock, flags);
 	if (!list_empty(&cqp->cqp_avail_reqs)) {
-		cqp_request = list_entry(cqp->cqp_avail_reqs.next,
-					 struct irdma_cqp_request, list);
+		cqp_request = list_first_entry(&cqp->cqp_avail_reqs,
+					       struct irdma_cqp_request, list);
 		list_del_init(&cqp_request->list);
 	}
 	spin_unlock_irqrestore(&cqp->req_lock, flags);
-- 
2.27.0


             reply	other threads:[~2021-06-08 21:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 21:14 Shiraz Saleem [this message]
2021-06-08 23:04 ` [PATCH rdma-next v1] irdma: Use list_last_entry/list_first_entry Jason Gunthorpe
2021-06-08 23:19   ` Saleem, Shiraz
2021-06-08 23:25     ` Jason Gunthorpe
2021-06-09  6:45 ` Dan Carpenter

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=20210608211415.680-1-shiraz.saleem@intel.com \
    --to=shiraz.saleem@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    /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.