FROMLIST: staging: android: ashmem: remove usage of list iterator after the loop... 30/310530/1
authorJakob Koschel <jakobkoschel@gmail.com>
Thu, 31 Mar 2022 21:39:34 +0000 (23:39 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 30 Apr 2024 08:34:19 +0000 (17:34 +0900)
commit69ae5f62acaf2a06f67ec363b9b20404d6b2e6d4
treeaa901c5186cfe25917466df1192dd324b3dd325d
parent77cf82e2cfe621de494e764a935cdad95c4a6944
FROMLIST: staging: android: ashmem: remove usage of list iterator after the loop body

In preparation to limit the scope of a list iterator to the list
traversal loop, use a dedicated pointer to point to the found element
[1].

Before, the code implicitly used the head when no element was found
when using &pos->list. Since the new variable is only set if an
element was found, the head needs to be used explicitly if the
variable is NULL.

Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
[sw0312.kim: cherry-pick commit 4f49a861af66 of https://android.googlesource.com/kernel/common/+/refs/heads/android15-6.6 to support waydroid on tizen]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ifaf19dd876a513a1952fac448079d664aebdf604
drivers/staging/android/ashmem.c