2021-06-08 03:03:43

by Baokun Li

[permalink] [raw]
Subject: [PATCH -next] RDMA/irdma: Use list_move instead of list_del/list_add

Using list_move() instead of list_del() + list_add().

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Baokun Li <[email protected]>
---
drivers/infiniband/hw/irdma/puda.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/irdma/puda.c b/drivers/infiniband/hw/irdma/puda.c
index 18057139817d..c0be6e37d425 100644
--- a/drivers/infiniband/hw/irdma/puda.c
+++ b/drivers/infiniband/hw/irdma/puda.c
@@ -1420,8 +1420,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);
- list_del(&buf->list);
- list_add(&buf->list, rxlist);
+ list_move(&buf->list, rxlist);
}
if (txbuf)
irdma_puda_ret_bufpool(ieq, txbuf);


2021-06-08 09:20:14

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH -next] RDMA/irdma: Use list_move instead of list_del/list_add

On Tue, Jun 08, 2021 at 11:10:41AM +0800, Baokun Li wrote:
> Using list_move() instead of list_del() + list_add().
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Baokun Li <[email protected]>
> ---
> drivers/infiniband/hw/irdma/puda.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/hw/irdma/puda.c b/drivers/infiniband/hw/irdma/puda.c
> index 18057139817d..c0be6e37d425 100644
> --- a/drivers/infiniband/hw/irdma/puda.c
> +++ b/drivers/infiniband/hw/irdma/puda.c
> @@ -1420,8 +1420,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);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Not related to your patch but this would be nicer as:

buf = list_last_entry(&pbufl, struct irdma_puda_buf, list);

> - list_del(&buf->list);
> - list_add(&buf->list, rxlist);
> + list_move(&buf->list, rxlist);

regards,
dan carpenter

2021-06-09 05:54:29

by Shiraz Saleem

[permalink] [raw]
Subject: RE: [PATCH -next] RDMA/irdma: Use list_move instead of list_del/list_add

> Subject: [PATCH -next] RDMA/irdma: Use list_move instead of list_del/list_add
>
> Using list_move() instead of list_del() + list_add().
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Baokun Li <[email protected]>
> ---

Acked-by: Shiraz Saleem <[email protected]>

2021-06-09 11:42:14

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH -next] RDMA/irdma: Use list_move instead of list_del/list_add

On Tue, Jun 08, 2021 at 11:10:41AM +0800, Baokun Li wrote:
> Using list_move() instead of list_del() + list_add().
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Baokun Li <[email protected]>
> Acked-by: Shiraz Saleem <[email protected]>
> ---
> drivers/infiniband/hw/irdma/puda.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Applied to for-next, thanks

Jason