rapidio: remove unnecessary use of list iterator
authorJakob Koschel <jakobkoschel@gmail.com>
Fri, 29 Apr 2022 21:38:03 +0000 (14:38 -0700)
committerakpm <akpm@linux-foundation.org>
Fri, 29 Apr 2022 21:38:03 +0000 (14:38 -0700)
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/
Link: https://lkml.kernel.org/r/20220319203344.2547702-1-jakobkoschel@gmail.com
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Alexandre Bounine <alex.bou9@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: "Brian Johannesmeyer" <bjohannesmeyer@gmail.com>
Cc: Cristiano Giuffrida <c.giuffrida@vu.nl>
Cc: "Bos, H.J." <h.j.bos@vu.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/rapidio/devices/rio_mport_cdev.c

index 7df466e222820398383a87fc054211781f9431fb..2cdc054e53a53dcce6c44a9e30916f6d4d23347b 100644 (file)
@@ -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);
        }