* [PATCH rdma-next] irdma: Use list_last_entry/list_first_entry
@ 2021-06-08 19:44 Shiraz Saleem
2021-06-08 19:59 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Shiraz Saleem @ 2021-06-08 19:44 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, Shiraz Saleem, Dan Carpenter
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>
---
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 1805713..e09d3be 100644
--- a/drivers/infiniband/hw/irdma/puda.c
+++ b/drivers/infiniband/hw/irdma/puda.c
@@ -1419,7 +1419,7 @@ static void irdma_ieq_compl_pfpdu(struct irdma_puda_rsrc *ieq,
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 8ce3535..81e590f 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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH rdma-next] irdma: Use list_last_entry/list_first_entry
2021-06-08 19:44 [PATCH rdma-next] irdma: Use list_last_entry/list_first_entry Shiraz Saleem
@ 2021-06-08 19:59 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2021-06-08 19:59 UTC (permalink / raw)
To: Shiraz Saleem; +Cc: dledford, linux-rdma, Dan Carpenter
On Tue, Jun 08, 2021 at 02:44:14PM -0500, Shiraz Saleem wrote:
> 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>
> 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 1805713..e09d3be 100644
> +++ b/drivers/infiniband/hw/irdma/puda.c
> @@ -1419,7 +1419,7 @@ static void irdma_ieq_compl_pfpdu(struct irdma_puda_rsrc *ieq,
>
> 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);
> }
This doesn't apply, nothing like this exists in my tree??
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-08 20:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 19:44 [PATCH rdma-next] irdma: Use list_last_entry/list_first_entry Shiraz Saleem
2021-06-08 19:59 ` Jason Gunthorpe
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.