All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rapidio: remove unnecessary use of list iterator
@ 2022-03-19 20:33 Jakob Koschel
  2022-03-20 22:50 ` John Hubbard
  0 siblings, 1 reply; 2+ messages in thread
From: Jakob Koschel @ 2022-03-19 20:33 UTC (permalink / raw)
  To: Matt Porter
  Cc: Jakob Koschel, linux-kernel, Alexandre Bounine, Kees Cook,
	John Hubbard, Andrew Morton, Mike Rapoport, Brian Johannesmeyer,
	Cristiano Giuffrida, Bos, H.J.

req->map is set in the valid case and always equals 'map' if the break
was hit. It therefore is unnecessary to use the list iterator variable
and the use of 'map' can be replaced with req->map.

This is done in preparation to limit the scope of a list iterator to
the list traversal loop [1].

Link: https://lore.kernel.org/all/YhdfEIwI4EdtHdym@kroah.com/
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
---
 drivers/rapidio/devices/rio_mport_cdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
index 7df466e22282..2cdc054e53a5 100644
--- a/drivers/rapidio/devices/rio_mport_cdev.c
+++ b/drivers/rapidio/devices/rio_mport_cdev.c
@@ -915,7 +915,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
 			goto err_req;
 		}

-		if (xfer->length + xfer->offset > map->size) {
+		if (xfer->length + xfer->offset > req->map->size) {
 			ret = -EINVAL;
 			goto err_req;
 		}
@@ -927,7 +927,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
 		}

 		sg_set_buf(req->sgt.sgl,
-			   map->virt_addr + (baddr - map->phys_addr) +
+			   req->map->virt_addr + (baddr - req->map->phys_addr) +
 				xfer->offset, xfer->length);
 	}


base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601
--
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rapidio: remove unnecessary use of list iterator
  2022-03-19 20:33 [PATCH] rapidio: remove unnecessary use of list iterator Jakob Koschel
@ 2022-03-20 22:50 ` John Hubbard
  0 siblings, 0 replies; 2+ messages in thread
From: John Hubbard @ 2022-03-20 22:50 UTC (permalink / raw)
  To: Jakob Koschel, Matt Porter
  Cc: linux-kernel, Alexandre Bounine, Kees Cook, Andrew Morton,
	Mike Rapoport, Brian Johannesmeyer, Cristiano Giuffrida, Bos,
	H.J.

On 3/19/22 13:33, Jakob Koschel wrote:
> req->map is set in the valid case and always equals 'map' if the break
> was hit. It therefore is unnecessary to use the list iterator variable
> and the use of 'map' can be replaced with req->map.
> 
> This is done in preparation to limit the scope of a list iterator to
> the list traversal loop [1].
> 
> Link: https://lore.kernel.org/all/YhdfEIwI4EdtHdym@kroah.com/
> Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
> ---
>   drivers/rapidio/devices/rio_mport_cdev.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
> index 7df466e22282..2cdc054e53a5 100644
> --- a/drivers/rapidio/devices/rio_mport_cdev.c
> +++ b/drivers/rapidio/devices/rio_mport_cdev.c
> @@ -915,7 +915,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
>   			goto err_req;
>   		}
> 
> -		if (xfer->length + xfer->offset > map->size) {
> +		if (xfer->length + xfer->offset > req->map->size) {
>   			ret = -EINVAL;
>   			goto err_req;
>   		}
> @@ -927,7 +927,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
>   		}
> 
>   		sg_set_buf(req->sgt.sgl,
> -			   map->virt_addr + (baddr - map->phys_addr) +
> +			   req->map->virt_addr + (baddr - req->map->phys_addr) +
>   				xfer->offset, xfer->length);
>   	}

I'm not a RapidIO expert, but this change is small and clearly correct,
so:

Reviewed-by: John Hubbard <jhubbard@nvidia.com>


thanks,
-- 
John Hubbard
NVIDIA
> 
> 
> base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601
> --
> 2.25.1
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-20 22:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 20:33 [PATCH] rapidio: remove unnecessary use of list iterator Jakob Koschel
2022-03-20 22:50 ` John Hubbard

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.