On Tue, Jun 08, 2021 at 04:14:16PM -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@xxxxxxxxxx> > Signed-off-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx> > --- > 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); Thanks for doing this one too. :) regards, dan carpenter