@@ -566,8 +566,8 @@ static void spu_unschedule(struct spu_gang *gang)
BUG_ON(spu->gang != gang);
BUG_ON(spu->alloc_state != SPU_USED);
node = spu->node;
- spu_unbind_context(spu, ctx);
mutex_lock(&cbe_spu_info[node].list_mutex);
+ spu_unbind_context(spu, ctx);
cbe_spu_info[node].nr_active--;
spu->alloc_state = SPU_FREE;
spu->ctx = NULL;
@@ -1289,6 +1289,7 @@ static int spusched_thread(void *unused)
gang = spu->gang;
BUG_ON(!gang);
ctx = spu->ctx;
+ BUG_ON(!ctx);
get_spu_context(ctx);
mutex_unlock(mtx);
preempted += spusched_tick(gang, ctx,
Also, add a related BUG_ON. Signed-off-by: Andre Detsch <adetsch@br.ibm.com> --- arch/powerpc/platforms/cell/spufs/sched.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)