Skip to contentSkip to conversation

rapidio: remove unnecessary use of list iterator

PATCH Applied Jakob Koschel 2 participants 2 messages Mar 19, 2022 – Mar 20, 2022 Rapidio

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rapidio: remove unnecessary use of list iterator

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].

---
 drivers/rapidio/devices/rio_mport_cdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rapidio/devices/rio_mport_cdev.c +2 -2
index 7df466e22282..2cdc054e53a5 100644
@@ -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

Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Jakob Koschel

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].

---
  drivers/rapidio/devices/rio_mport_cdev.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rapidio/devices/rio_mport_cdev.c +1 -1
index 7df466e22282..2cdc054e53a5 100644
@@ -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;
  		}

drivers/rapidio/devices/rio_mport_cdev.c rio_dma_transfer(struct file *filp, u32 transfer_mode, · line 932

Quoted 7 lines
drivers/rapidio/devices/rio_mport_cdev.c +1 -1
@@ -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:

thanks,

Signature · 2 lines
John Hubbard
NVIDIA
Quoted 6 lines

base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601 --
2.25.1