[PATCH] powerpc: Fix error path in kernel_thread function

Segher Boessenkool segher at kernel.crashing.org
Wed Oct 8 05:30:20 EST 2008


> -	cmpwi	0,r3,0		/* parent or child? */
> -	bne	1f		/* return if parent */
> +	bns+	1f		/* did system call indicate error? */
> +	neg	r3,r3		/* if so, make return code negative */
> +1:	cmpwi	0,r3,0		/* parent or child? */
> +	bne	2f		/* return if parent */
>  	li	r0,0		/* make top-level stack frame */
>  	stwu	r0,-16(r1)
>  	mtlr	r30		/* fn addr in lr */
> @@ -857,7 +859,7 @@ _GLOBAL(kernel_thread)
>  	li	r0,__NR_exit	/* exit if function returns */
>  	li	r3,0
>  	sc
> -1:	lwz	r30,8(r1)
> +2:	lwz	r30,8(r1)

You don't need to renumber the labels, FWIW.  Some people might
find it more readable this way of course (but then, you could
use actual label _names_ -- what a novel idea! ;-) )


Segher




More information about the Linuxppc-dev mailing list