From 7cf51d34af7ad86fc14bbc2217d733f271e396e7 Mon Sep 17 00:00:00 2001 From: simran singhal Date: Fri, 10 Mar 2017 10:43:11 +0530 Subject: [PATCH] staging: vpfe_mc_capture: 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 Signed-off-by: Greg Kroah-Hartman --- 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 32109cdd73a6..bffe2153b910 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.20.1