2022-02-17 20:22:18

by Jakob Koschel

[permalink] [raw]
Subject: [RFC PATCH 10/13] powerpc/spufs: future proof usage of list iterator after the loop

With the speculative safe version of the list iterator spu will be NULL
if the terminating condition was hit and needs to be reset to spu
derived from the head, before returning spu.

Signed-off-by: Jakob Koschel <[email protected]>
---
arch/powerpc/platforms/cell/spufs/sched.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 369206489895..5b2afda1653d 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -384,6 +384,8 @@ static struct spu *ctx_location(struct spu *ref, int offset, int node)
}
}

+ if (!spu)
+ spu = list_entry(spu, ref->aff_list.prev, aff_list);
return spu;
}

--
2.25.1