staging: media: omap4iss: Fixes NULL comparison
authorAmarjargal Gundjalam <amarjargal.gundjalam@gmail.com>
Mon, 26 Oct 2015 13:09:27 +0000 (06:09 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Oct 2015 07:53:12 +0000 (16:53 +0900)
This patch fixes the checkpatch issue:

CHECK: Comparison to NULL could be written

Signed-off-by: Amarjargal Gundjalam <amarjargal.gundjalam@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/omap4iss/iss.c
drivers/staging/media/omap4iss/iss_csi2.c
drivers/staging/media/omap4iss/iss_ipipe.c
drivers/staging/media/omap4iss/iss_ipipeif.c
drivers/staging/media/omap4iss/iss_resizer.c
drivers/staging/media/omap4iss/iss_video.c

index 9bfb725b9986ccbe86bc3bf9069d2e9dbb5c524e..104fc582b7369a40c64456f549dc0553794309ef 100644 (file)
@@ -151,7 +151,7 @@ int omap4iss_get_external_info(struct iss_pipeline *pipe,
 
        ctrl = v4l2_ctrl_find(pipe->external->ctrl_handler,
                              V4L2_CID_PIXEL_RATE);
-       if (ctrl == NULL) {
+       if (!ctrl) {
                dev_warn(iss->dev, "no pixel rate control in subdev %s\n",
                         pipe->external->name);
                return -EPIPE;
@@ -422,7 +422,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change)
        subdev = media_entity_type(entity) == MEDIA_ENT_T_V4L2_SUBDEV
               ? media_entity_to_v4l2_subdev(entity) : NULL;
 
-       if (entity->use_count == 0 && change > 0 && subdev != NULL) {
+       if (entity->use_count == 0 && change > 0 && subdev) {
                int ret;
 
                ret = v4l2_subdev_call(subdev, core, s_power, 1);
@@ -433,7 +433,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change)
        entity->use_count += change;
        WARN_ON(entity->use_count < 0);
 
-       if (entity->use_count == 0 && change < 0 && subdev != NULL)
+       if (entity->use_count == 0 && change < 0 && subdev)
                v4l2_subdev_call(subdev, core, s_power, 0);
 
        return 0;
@@ -590,7 +590,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,
                        break;
 
                pad = media_entity_remote_pad(pad);
-               if (pad == NULL ||
+               if (!pad ||
                    media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
                        break;
 
@@ -658,7 +658,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
                        break;
 
                pad = media_entity_remote_pad(pad);
-               if (pad == NULL ||
+               if (!pad ||
                    media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
                        break;
 
@@ -1050,7 +1050,7 @@ struct iss_device *omap4iss_get(struct iss_device *iss)
 {
        struct iss_device *__iss = iss;
 
-       if (iss == NULL)
+       if (!iss)
                return NULL;
 
        mutex_lock(&iss->iss_mutex);
@@ -1065,7 +1065,7 @@ struct iss_device *omap4iss_get(struct iss_device *iss)
        iss_enable_interrupts(iss);
 
 out:
-       if (__iss != NULL)
+       if (__iss)
                iss->ref_count++;
        mutex_unlock(&iss->iss_mutex);
 
@@ -1080,7 +1080,7 @@ out:
  */
 void omap4iss_put(struct iss_device *iss)
 {
-       if (iss == NULL)
+       if (!iss)
                return;
 
        mutex_lock(&iss->iss_mutex);
@@ -1142,7 +1142,7 @@ iss_register_subdev_group(struct iss_device *iss,
        struct v4l2_subdev *sensor = NULL;
        unsigned int first;
 
-       if (board_info->board_info == NULL)
+       if (!board_info->board_info)
                return NULL;
 
        for (first = 1; board_info->board_info; ++board_info, first = 0) {
@@ -1150,7 +1150,7 @@ iss_register_subdev_group(struct iss_device *iss,
                struct i2c_adapter *adapter;
 
                adapter = i2c_get_adapter(board_info->i2c_adapter_id);
-               if (adapter == NULL) {
+               if (!adapter) {
                        dev_err(iss->dev,
                                "%s: Unable to get I2C adapter %d for device %s\n",
                                __func__, board_info->i2c_adapter_id,
@@ -1160,7 +1160,7 @@ iss_register_subdev_group(struct iss_device *iss,
 
                subdev = v4l2_i2c_new_subdev_board(&iss->v4l2_dev, adapter,
                                board_info->board_info, NULL);
-               if (subdev == NULL) {
+               if (!subdev) {
                        dev_err(iss->dev, "Unable to register subdev %s\n",
                                board_info->board_info->type);
                        continue;
@@ -1228,7 +1228,7 @@ static int iss_register_entities(struct iss_device *iss)
                unsigned int pad;
 
                sensor = iss_register_subdev_group(iss, subdevs->subdevs);
-               if (sensor == NULL)
+               if (!sensor)
                        continue;
 
                sensor->host_priv = subdevs;
@@ -1369,7 +1369,7 @@ static int iss_probe(struct platform_device *pdev)
        unsigned int i;
        int ret;
 
-       if (pdata == NULL)
+       if (!pdata)
                return -EINVAL;
 
        iss = devm_kzalloc(&pdev->dev, sizeof(*iss), GFP_KERNEL);
@@ -1406,7 +1406,7 @@ static int iss_probe(struct platform_device *pdev)
        if (ret < 0)
                goto error;
 
-       if (omap4iss_get(iss) == NULL)
+       if (!omap4iss_get(iss))
                goto error;
 
        ret = iss_reset(iss);
index bc83f8246101a4fd726f5314a98190a83c9909d0..c6e6d47ac57f371695d7b02cac96ee9e42cce9ad 100644 (file)
@@ -658,7 +658,7 @@ static void csi2_isr_buffer(struct iss_csi2_device *csi2)
         * Let video queue operation restart engine if there is an underrun
         * condition.
         */
-       if (buffer == NULL)
+       if (!buffer)
                return;
 
        csi2_set_outaddr(csi2, buffer->iss_addr);
@@ -979,7 +979,7 @@ static int csi2_get_format(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *format;
 
        format = __csi2_get_format(csi2, cfg, fmt->pad, fmt->which);
-       if (format == NULL)
+       if (!format)
                return -EINVAL;
 
        fmt->format = *format;
@@ -1001,7 +1001,7 @@ static int csi2_set_format(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *format;
 
        format = __csi2_get_format(csi2, cfg, fmt->pad, fmt->which);
-       if (format == NULL)
+       if (!format)
                return -EINVAL;
 
        csi2_try_format(csi2, cfg, fmt->pad, &fmt->format, fmt->which);
index f94a59299a83b841b92fd39ed41f747c867a3196..fcde8a65cc2a5d2da011d8525f4e3f0edb5a0e3e 100644 (file)
@@ -320,7 +320,7 @@ static int ipipe_get_format(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *format;
 
        format = __ipipe_get_format(ipipe, cfg, fmt->pad, fmt->which);
-       if (format == NULL)
+       if (!format)
                return -EINVAL;
 
        fmt->format = *format;
@@ -344,7 +344,7 @@ static int ipipe_set_format(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *format;
 
        format = __ipipe_get_format(ipipe, cfg, fmt->pad, fmt->which);
-       if (format == NULL)
+       if (!format)
                return -EINVAL;
 
        ipipe_try_format(ipipe, cfg, fmt->pad, &fmt->format, fmt->which);
index c0da13d55865ae32981b99873dac462c56a83bbc..fcafdbe25c4c86c9f43ed9da7d13180f93ce6145 100644 (file)
@@ -233,7 +233,7 @@ static void ipipeif_isr_buffer(struct iss_ipipeif_device *ipipeif)
        ipipeif_write_enable(ipipeif, 0);
 
        buffer = omap4iss_video_buffer_next(&ipipeif->video_out);
-       if (buffer == NULL)
+       if (!buffer)
                return;
 
        ipipeif_set_outaddr(ipipeif, buffer->iss_addr);
@@ -526,7 +526,7 @@ static int ipipeif_get_format(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *format;
 
        format = __ipipeif_get_format(ipipeif, cfg, fmt->pad, fmt->which);
-       if (format == NULL)
+       if (!format)
                return -EINVAL;
 
        fmt->format = *format;
@@ -550,7 +550,7 @@ static int ipipeif_set_format(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *format;
 
        format = __ipipeif_get_format(ipipeif, cfg, fmt->pad, fmt->which);
-       if (format == NULL)
+       if (!format)
                return -EINVAL;
 
        ipipeif_try_format(ipipeif, cfg, fmt->pad, &fmt->format, fmt->which);
index 5030cf3cd34c87c5aec6b30f4cf8f99fbca3b4a9..8035e01c7eb710dfafc1d2b735d8de6a5f951f30 100644 (file)
@@ -274,7 +274,7 @@ static void resizer_isr_buffer(struct iss_resizer_device *resizer)
        resizer_enable(resizer, 0);
 
        buffer = omap4iss_video_buffer_next(&resizer->video_out);
-       if (buffer == NULL)
+       if (!buffer)
                return;
 
        resizer_set_outaddr(resizer, buffer->iss_addr);
@@ -588,7 +588,7 @@ static int resizer_get_format(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *format;
 
        format = __resizer_get_format(resizer, cfg, fmt->pad, fmt->which);
-       if (format == NULL)
+       if (!format)
                return -EINVAL;
 
        fmt->format = *format;
@@ -612,7 +612,7 @@ static int resizer_set_format(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *format;
 
        format = __resizer_get_format(resizer, cfg, fmt->pad, fmt->which);
-       if (format == NULL)
+       if (!format)
                return -EINVAL;
 
        resizer_try_format(resizer, cfg, fmt->pad, &fmt->format, fmt->which);
index 40405d8710a65cf9ca61148970a1f1afebbe2f62..a98991a2c7fdd83e77af9061670990bf39be3cbf 100644 (file)
@@ -191,7 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32 *pad)
 
        remote = media_entity_remote_pad(&video->pad);
 
-       if (remote == NULL ||
+       if (!remote ||
            media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
                return NULL;
 
@@ -241,7 +241,7 @@ __iss_video_get_format(struct iss_video *video,
        int ret;
 
        subdev = iss_video_remote_subdev(video, &pad);
-       if (subdev == NULL)
+       if (!subdev)
                return -EINVAL;
 
        memset(&fmt, 0, sizeof(fmt));
@@ -471,7 +471,7 @@ struct iss_buffer *omap4iss_video_buffer_next(struct iss_video *video)
                return NULL;
        }
 
-       if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input != NULL) {
+       if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input) {
                spin_lock(&pipe->lock);
                pipe->state &= ~ISS_PIPELINE_STREAM;
                spin_unlock(&pipe->lock);
@@ -624,7 +624,7 @@ iss_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
                return -EINVAL;
 
        subdev = iss_video_remote_subdev(video, &pad);
-       if (subdev == NULL)
+       if (!subdev)
                return -EINVAL;
 
        iss_video_pix_to_mbus(&format->fmt.pix, &fmt.format);
@@ -806,7 +806,7 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
                pipe->input = far_end;
                pipe->output = video;
        } else {
-               if (far_end == NULL) {
+               if (!far_end) {
                        ret = -EPIPE;
                        goto err_iss_video_check_format;
                }
@@ -841,7 +841,7 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
         * to the stream on command. In memory-to-memory mode, it will be
         * started when buffers are queued on both the input and output.
         */
-       if (pipe->input == NULL) {
+       if (!pipe->input) {
                unsigned long flags;
 
                ret = omap4iss_pipeline_set_stream(pipe,
@@ -974,14 +974,14 @@ static int iss_video_open(struct file *file)
        int ret = 0;
 
        handle = kzalloc(sizeof(*handle), GFP_KERNEL);
-       if (handle == NULL)
+       if (!handle)
                return -ENOMEM;
 
        v4l2_fh_init(&handle->vfh, &video->video);
        v4l2_fh_add(&handle->vfh);
 
        /* If this is the first user, initialise the pipeline. */
-       if (omap4iss_get(video->iss) == NULL) {
+       if (!omap4iss_get(video->iss)) {
                ret = -EBUSY;
                goto done;
        }
@@ -1116,7 +1116,7 @@ int omap4iss_video_init(struct iss_video *video, const char *name)
        mutex_init(&video->stream_lock);
 
        /* Initialize the video device. */
-       if (video->ops == NULL)
+       if (!video->ops)
                video->ops = &iss_video_dummy_ops;
 
        video->video.fops = &iss_video_fops;