lkml.org 
[lkml]   [2022]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 10/13] powerpc/spufs: future proof usage of list iterator after the loop
Date
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@gmail.com>
---
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
\
 
 \ /
  Last update: 2022-02-17 19:51    [W:0.247 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site