[PATCH] drivers/char: don't use IS_ERR()

From: Thomas Meyer
Date: Wed Aug 10 2011 - 13:42:31 EST

From: Thomas Meyer <thomas@xxxxxxxx>

The various basic memory allocation functions don't return ERR_PTR

The semantic patch that makes this change is available
in scripts/coccinelle/null/eno.cocci.

More information about semantic patching is available at

Signed-off-by: Thomas Meyer <thomas@xxxxxxxx>

diff --git a/drivers/char/msm_smd_pkt.c b/drivers/char/msm_smd_pkt.c
index b6f8a65..ceece48 100644
--- a/drivers/char/msm_smd_pkt.c
+++ b/drivers/char/msm_smd_pkt.c
@@ -379,9 +379,8 @@ static int __init smd_pkt_init(void)
for (i = 0; i < NUM_SMD_PKT_PORTS; ++i) {
smd_pkt_devp[i] = kzalloc(sizeof(struct smd_pkt_dev),
- if (IS_ERR(smd_pkt_devp[i])) {
- r = PTR_ERR(smd_pkt_devp[i]);
- pr_err("kmalloc() failed %d\n", r);
+ if (!smd_pkt_devp[i]) {
+ pr_err("kmalloc() failed\n");
goto clean_cdevs;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/