diff options
author | simran singhal | 2017-03-10 02:13:12 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab | 2017-04-17 16:58:11 -0300 |
commit | a1aae088e7f9dbd97164bbacc2b624d9bacd98a3 (patch) | |
tree | 2a05ddf3e766a5a21df5fdd3bea6064bcdae3893 | |
parent | 6eb1951d53a3eeb8cefa101b8022f5f6572f9d5d (diff) |
[media] staging: lirc_zilog: Clean up tests if NULL returned on failure
Some functions like kmalloc/kzalloc return NULL on failure.
When NULL represents failure, !x is commonly used.
This was done using Coccinelle:
@@
expression *e;
identifier l1;
@@
e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(...);
...
- e == NULL
+ !e
Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/staging/media/lirc/lirc_zilog.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 24735521edae..8ce1db04414a 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -1475,7 +1475,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ir = get_ir_device_by_adapter(adap); if (ir == NULL) { ir = kzalloc(sizeof(struct IR), GFP_KERNEL); - if (ir == NULL) { + if (!ir) { ret = -ENOMEM; goto out_no_ir; } @@ -1515,7 +1515,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Set up a struct IR_tx instance */ tx = kzalloc(sizeof(struct IR_tx), GFP_KERNEL); - if (tx == NULL) { + if (!tx) { ret = -ENOMEM; goto out_put_xx; } @@ -1559,7 +1559,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Set up a struct IR_rx instance */ rx = kzalloc(sizeof(struct IR_rx), GFP_KERNEL); - if (rx == NULL) { + if (!rx) { ret = -ENOMEM; goto out_put_xx; } |