* [PATCH 0/3] staging: media: Clean up tests if NULL returned on failure
@ 2017-03-10 5:13 simran singhal
2017-03-10 5:13 ` [PATCH 1/3] staging: atomisp_fops: " simran singhal
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: simran singhal @ 2017-03-10 5:13 UTC (permalink / raw)
To: gregkh; +Cc: devel, jarod, mchehab, linux-media
This patch series tests if functions like kmalloc/kzalloc return NULL
on failure. When NULL represents failure, !x is commonly used.
simran singhal (3):
staging: atomisp_fops: Clean up tests if NULL returned on failure
staging: vpfe_mc_capture: Clean up tests if NULL returned on failure
staging: lirc_zilog: Clean up tests if NULL returned on failure
drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c | 2 +-
drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 4 ++--
drivers/staging/media/lirc/lirc_zilog.c | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] staging: atomisp_fops: Clean up tests if NULL returned on failure
2017-03-10 5:13 [PATCH 0/3] staging: media: Clean up tests if NULL returned on failure simran singhal
@ 2017-03-10 5:13 ` simran singhal
2017-03-10 5:13 ` [PATCH 2/3] staging: vpfe_mc_capture: " simran singhal
2017-03-10 5:13 ` [PATCH 3/3] staging: lirc_zilog: " simran singhal
2 siblings, 0 replies; 4+ messages in thread
From: simran singhal @ 2017-03-10 5:13 UTC (permalink / raw)
To: gregkh; +Cc: devel, jarod, mchehab, linux-media
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>
---
drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
index 20e581e..e5a7407 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
@@ -1100,7 +1100,7 @@ int atomisp_videobuf_mmap_mapper(struct videobuf_queue *q,
continue;
map = kzalloc(sizeof(struct videobuf_mapping), GFP_KERNEL);
- if (map == NULL) {
+ if (!map) {
mutex_unlock(&q->vb_lock);
return -ENOMEM;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] staging: vpfe_mc_capture: Clean up tests if NULL returned on failure
2017-03-10 5:13 [PATCH 0/3] staging: media: Clean up tests if NULL returned on failure simran singhal
2017-03-10 5:13 ` [PATCH 1/3] staging: atomisp_fops: " simran singhal
@ 2017-03-10 5:13 ` simran singhal
2017-03-10 5:13 ` [PATCH 3/3] staging: lirc_zilog: " simran singhal
2 siblings, 0 replies; 4+ messages in thread
From: simran singhal @ 2017-03-10 5:13 UTC (permalink / raw)
To: gregkh; +Cc: devel, jarod, mchehab, linux-media
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>
---
drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
index 32109cd..bffe215 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
@@ -228,7 +228,7 @@ static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)
vpfe_dev->clks = kcalloc(vpfe_cfg->num_clocks,
sizeof(*vpfe_dev->clks), GFP_KERNEL);
- if (vpfe_dev->clks == NULL)
+ if (!vpfe_dev->clks)
return -ENOMEM;
for (i = 0; i < vpfe_cfg->num_clocks; i++) {
@@ -348,7 +348,7 @@ static int register_i2c_devices(struct vpfe_device *vpfe_dev)
vpfe_dev->sd =
kcalloc(num_subdevs, sizeof(struct v4l2_subdev *),
GFP_KERNEL);
- if (vpfe_dev->sd == NULL)
+ if (!vpfe_dev->sd)
return -ENOMEM;
for (i = 0, k = 0; i < num_subdevs; i++) {
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] staging: lirc_zilog: Clean up tests if NULL returned on failure
2017-03-10 5:13 [PATCH 0/3] staging: media: Clean up tests if NULL returned on failure simran singhal
2017-03-10 5:13 ` [PATCH 1/3] staging: atomisp_fops: " simran singhal
2017-03-10 5:13 ` [PATCH 2/3] staging: vpfe_mc_capture: " simran singhal
@ 2017-03-10 5:13 ` simran singhal
2 siblings, 0 replies; 4+ messages in thread
From: simran singhal @ 2017-03-10 5:13 UTC (permalink / raw)
To: gregkh; +Cc: devel, jarod, mchehab, linux-media
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>
---
drivers/staging/media/lirc/lirc_zilog.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c
index 34aac3e..4836182 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;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-10 5:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 5:13 [PATCH 0/3] staging: media: Clean up tests if NULL returned on failure simran singhal
2017-03-10 5:13 ` [PATCH 1/3] staging: atomisp_fops: " simran singhal
2017-03-10 5:13 ` [PATCH 2/3] staging: vpfe_mc_capture: " simran singhal
2017-03-10 5:13 ` [PATCH 3/3] staging: lirc_zilog: " simran singhal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.