[Cbe-oss-dev] [PATCH 2:10] spufs: fix freeing of spu switch log

Michael Ellerman michael at ellerman.id.au
Fri May 23 11:18:15 EST 2008


On Thu, 2008-05-22 at 20:09 +0000, Luke Browning wrote:
> Fix freeing of spu switch log 
> 
> Signed-off-by: Luke Browning <lukebrowning at us.ibm.com>
> 
> ---
> 
> Index: linux-2.6.25/arch/powerpc/platforms/cell/spufs/context.c
> ===================================================================
> --- linux-2.6.25.orig/arch/powerpc/platforms/cell/spufs/context.c
> +++ linux-2.6.25/arch/powerpc/platforms/cell/spufs/context.c
> @@ -89,7 +89,8 @@ void destroy_spu_context(struct kref *kr
>  		kref_put(ctx->prof_priv_kref, ctx->prof_priv_release);
>  	BUG_ON(!list_empty(&ctx->rq));
>  	atomic_dec(&nr_spu_contexts);
> -	kfree(ctx->switch_log);
> +	if (ctx->switch_log)
> +		kfree(ctx->switch_log);
>  	kfree(ctx);

I'm not sure what you're fixing, kfree(NULL) is perfectly fine. If ctx
can be NULL you need to check for that though.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20080523/ea98f39e/attachment.pgp>


More information about the cbe-oss-dev mailing list