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

From: Jakob Koschel
Date: Thu Feb 17 2022 - 13:50:43 EST


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 <jakobkoschel@xxxxxxxxx>
---
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