Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: kzalloc doesn't return ERR_PTR

Use !x rather than IS_ERR(x) to test the result of kzalloc.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,E;
@@

x = \(kmalloc\|kzalloc\|kcalloc\)(...)
... when != x = E
- IS_ERR(x)
+ !x
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Julia Lawall and committed by
Samuel Ortiz
25fe24f8 c0d4010e

+1 -1
+1 -1
drivers/mfd/abx500-core.c
··· 36 36 struct abx500_device_entry *dev_entry; 37 37 38 38 dev_entry = kzalloc(sizeof(struct abx500_device_entry), GFP_KERNEL); 39 - if (IS_ERR(dev_entry)) { 39 + if (!dev_entry) { 40 40 dev_err(dev, "register_ops kzalloc failed"); 41 41 return -ENOMEM; 42 42 }