LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/mfd: kzalloc doesn't return ERR_PTR
@ 2010-05-28 20:58 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2010-05-28 20:58 UTC (permalink / raw
  To: Samuel Ortiz, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

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>

---
 drivers/mfd/abx500-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c
--- a/drivers/mfd/abx500-core.c
+++ b/drivers/mfd/abx500-core.c
@@ -36,7 +36,7 @@ int abx500_register_ops(struct device *d
 	struct abx500_device_entry *dev_entry;
 
 	dev_entry = kzalloc(sizeof(struct abx500_device_entry), GFP_KERNEL);
-	if (IS_ERR(dev_entry)) {
+	if (!dev_entry) {
 		dev_err(dev, "register_ops kzalloc failed");
 		return -ENOMEM;
 	}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-28 20:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-28 20:58 [PATCH] drivers/mfd: kzalloc doesn't return ERR_PTR Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).