diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-08-28 13:50:28 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-09-23 15:20:57 +0300 |
commit | af28c99628ebfbdc3fff3d92c7044d3a51b7ccea (patch) | |
tree | ff56a13fbd5ed6c2bb20a746464fd49fb0199c48 /drivers/media/usb/zr364xx | |
parent | 2d3da59ff163b2aa805de0fc65ba933a735b00cd (diff) | |
download | linux-af28c99628ebfbdc3fff3d92c7044d3a51b7ccea.tar.xz |
media: drivers: Adjust checks for null pointers
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written !…
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Diffstat (limited to 'drivers/media/usb/zr364xx')
-rw-r--r-- | drivers/media/usb/zr364xx/zr364xx.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c index b3d05027bd9a..1d888661fd03 100644 --- a/drivers/media/usb/zr364xx/zr364xx.c +++ b/drivers/media/usb/zr364xx/zr364xx.c @@ -385,9 +385,9 @@ static int buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, vb); int rc; - DBG("%s, field=%d, fmt name = %s\n", __func__, field, cam->fmt != NULL ? - cam->fmt->name : ""); - if (cam->fmt == NULL) + DBG("%s, field=%d, fmt name = %s\n", __func__, field, + cam->fmt ? cam->fmt->name : ""); + if (!cam->fmt) return -EINVAL; buf->vb.size = cam->width * cam->height * (cam->fmt->depth >> 3); @@ -787,7 +787,7 @@ static int zr364xx_vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct zr364xx_camera *cam = video_drvdata(file); char pixelformat_name[5]; - if (cam == NULL) + if (!cam) return -ENODEV; if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_JPEG) { @@ -817,7 +817,7 @@ static int zr364xx_vidioc_g_fmt_vid_cap(struct file *file, void *priv, { struct zr364xx_camera *cam; - if (file == NULL) + if (!file) return -ENODEV; cam = video_drvdata(file); @@ -979,13 +979,13 @@ static void read_pipe_completion(struct urb *purb) pipe_info = purb->context; _DBG("%s %p, status %d\n", __func__, purb, purb->status); - if (pipe_info == NULL) { + if (!pipe_info) { printk(KERN_ERR KBUILD_MODNAME ": no context!\n"); return; } cam = pipe_info->cam; - if (cam == NULL) { + if (!cam) { printk(KERN_ERR KBUILD_MODNAME ": no context!\n"); return; } @@ -1069,7 +1069,7 @@ static void zr364xx_stop_readpipe(struct zr364xx_camera *cam) { struct zr364xx_pipeinfo *pipe_info; - if (cam == NULL) { + if (!cam) { printk(KERN_ERR KBUILD_MODNAME ": invalid device\n"); return; } @@ -1273,7 +1273,7 @@ static int zr364xx_mmap(struct file *file, struct vm_area_struct *vma) struct zr364xx_camera *cam = video_drvdata(file); int ret; - if (cam == NULL) { + if (!cam) { DBG("%s: cam == NULL\n", __func__); return -ENODEV; } @@ -1357,7 +1357,7 @@ static int zr364xx_board_init(struct zr364xx_camera *cam) pipe->transfer_buffer = kzalloc(pipe->transfer_size, GFP_KERNEL); - if (pipe->transfer_buffer == NULL) { + if (!pipe->transfer_buffer) { DBG("out of memory!\n"); return -ENOMEM; } @@ -1373,7 +1373,7 @@ static int zr364xx_board_init(struct zr364xx_camera *cam) DBG("valloc %p, idx %lu, pdata %p\n", &cam->buffer.frame[i], i, cam->buffer.frame[i].lpvbits); - if (cam->buffer.frame[i].lpvbits == NULL) { + if (!cam->buffer.frame[i].lpvbits) { printk(KERN_INFO KBUILD_MODNAME ": out of memory. Using less frames\n"); break; } |