[PATCH 5/5] sound/aoa: Add kmalloc NULL tests

Johannes Berg johannes at sipsolutions.net
Fri Jul 31 00:17:00 EST 2009


On Thu, 2009-07-30 at 16:11 +0200, Julia Lawall wrote:
> From: Julia Lawall <julia at diku.dk>
> 
> Check that the result of kzalloc is not NULL before a dereference.

>  		irq_client = kzalloc(sizeof(struct pmf_irq_client),
>  				     GFP_KERNEL);
> +		if (!irq_client) {
> +			err = -ENOMEM;
> +			printk(KERN_ERR "snd-aoa: gpio layer failed to"
> +				" register %s irq (%d)\n", name, err);
> +			goto out_unlock;
> +		}

Looks good, thanks, but I'd really drop the printk if only to not have
the string there, that doesn't really seem interesting.

johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090730/517e28d6/attachment.pgp>


More information about the Linuxppc-dev mailing list