From patchwork Sun Sep 17 20:17:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9955063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACE186028A for ; Sun, 17 Sep 2017 20:18:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3F2E2895B for ; Sun, 17 Sep 2017 20:18:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98BA828969; Sun, 17 Sep 2017 20:18:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5831028A8D for ; Sun, 17 Sep 2017 20:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751678AbdIQUSd (ORCPT ); Sun, 17 Sep 2017 16:18:33 -0400 Received: from mout.web.de ([217.72.192.78]:51188 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbdIQUSb (ORCPT ); Sun, 17 Sep 2017 16:18:31 -0400 Received: from [192.168.1.2] ([77.181.201.34]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LwHxK-1dKq0C08K6-0183WQ; Sun, 17 Sep 2017 22:17:54 +0200 Subject: [PATCH 2/8] [media] cx231xx: Adjust 56 checks for null pointers From: SF Markus Elfring To: linux-media@vger.kernel.org, Bhumika Goyal , Hans Verkuil , Johan Hovold , Julia Lawall , Matthias Schwarzott , Mauro Carvalho Chehab , Oleh Kravchenko , Peter Rosin , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Sun, 17 Sep 2017 22:17:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:RwQAotzPpiPl1HfqdRK6WUF3booe1onVZQVcl4VxRISU5VW0aff Qr3jV0wAgMrTVHJ12gCu1LoojV0wxWE2MrVic5D7+7gmztJASGpmqJQIFVAqi4uosAvjUPf P5fPIqpYCtI2YpPqjI3MJ5qIk6ftzLo41AUp8UJ0U51ZsAlLecZKs3m4zq492d9ffFTW+pU I+aRxzktKPM92C0ZwrYww== X-UI-Out-Filterresults: notjunk:1; V01:K0:P2TT+yw2kyo=:rfkaP6ynC3cap1QkPBt9Db siFKL06Hxq3Oz9z29dAis40n/8iKeSIAQ55nE346harhYEaTvIybJJuSoPNI8aaZL7dwYE9u4 nFxgD5oEXkz9NnqqzULxdkyQ3TYG5OvZgP+x/BYmpUpRd0/Slvrn/bWt5EgwaL3WnUdIBM4+F pV7ZtPBSaEIr9CywoaeckCO0e1jWleoN4rdE2b0cjHVfRhTSYf39ejsOjAmb70TWojBj5A4ZE EqANbA8AGTMCdSQPxnkHPuzj5AA01/HQPw8+Wic32Cz8zlLFSDQX/7o0P3olXTpPoE3rjmSQp Gp4Xubkt7kRLA99LBDmQv45yOPs8CvbR38rAzjy4lgeYC/0+HTGi40guN1yibnFkca+4oXZH+ gGJscgqUU/J56/OunXvpHLmTALiDKoCRYRhwksLS3qy2tp79a8gEOia9c8eTL6aETcfof9CDE 2+g/ff74cp25m+jKrS0uPd1ZzbiaEMaLJdxIFJc82tEPEz5opgLpAkz/9CwQ792vaEPn7JMpM 073twC0HWw0mwBMHp0x0HFUn/auydOuCYWJ+LbPnUWmwH78xCRikOKwByLI4p5SPbr0wK+lvQ dvVez6WN84Lg1NfjdRvOPTqI9I6XQAXFWW4q+y4ZAYIyAwJqG4x5tyeVPL6KNGDVTP74eJ9j+ fISHu3eEjO2XINbeAfmB2g/wgv4KOCMyZuJS4JM2xQcSlRZSzYCckfdYhY7znMEG2H1g6QuW7 +rS4aZ4POjZSUM+Cbip3KXbEw7wufBPFgV99xlGOdwXD5hCKC2Sdpk5AeY6ed182H7GBLYn0M lQtmYrEkriKzUAfUQR+P5HhBVCQHlB9FvYNLvoXkve3mJuDvzU= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 17 Sep 2017 18:23:06 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- drivers/media/usb/cx231xx/cx231xx-417.c | 6 ++-- drivers/media/usb/cx231xx/cx231xx-audio.c | 2 +- drivers/media/usb/cx231xx/cx231xx-cards.c | 16 +++++----- drivers/media/usb/cx231xx/cx231xx-core.c | 20 ++++++------ drivers/media/usb/cx231xx/cx231xx-dvb.c | 51 ++++++++++++------------------- drivers/media/usb/cx231xx/cx231xx-vbi.c | 6 ++-- drivers/media/usb/cx231xx/cx231xx-video.c | 4 +-- 7 files changed, 45 insertions(+), 60 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c index d538fa407742..d43345593172 100644 --- a/drivers/media/usb/cx231xx/cx231xx-417.c +++ b/drivers/media/usb/cx231xx/cx231xx-417.c @@ -954,13 +954,13 @@ static int cx231xx_load_firmware(struct cx231xx *dev) p_current_fw = vmalloc(1884180 * 4); p_fw = p_current_fw; - if (p_current_fw == NULL) { + if (!p_current_fw) { dprintk(2, "FAIL!!!\n"); return -ENOMEM; } p_buffer = vmalloc(4096); - if (p_buffer == NULL) { + if (!p_buffer) { dprintk(2, "FAIL!!!\n"); vfree(p_current_fw); return -ENOMEM; @@ -1711,7 +1711,7 @@ static int mpeg_open(struct file *file) /* allocate + initialize per filehandle data */ fh = kzalloc(sizeof(*fh), GFP_KERNEL); - if (NULL == fh) { + if (!fh) { mutex_unlock(&dev->lock); return -ENOMEM; } diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c index 06f10d7fc4b0..f98ba0c66f8f 100644 --- a/drivers/media/usb/cx231xx/cx231xx-audio.c +++ b/drivers/media/usb/cx231xx/cx231xx-audio.c @@ -745,7 +745,7 @@ static int cx231xx_audio_init(struct cx231xx *dev) static int cx231xx_audio_fini(struct cx231xx *dev) { - if (dev == NULL) + if (!dev) return 0; if (dev->has_alsa_audio != 1) { diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index e0daa9b6c2a0..d204f220dfe5 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -1156,7 +1156,7 @@ void cx231xx_card_setup(struct cx231xx *dev) dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, cx231xx_get_i2c_adap(dev, I2C_0), "cx25840", 0x88 >> 1, NULL); - if (dev->sd_cx25840 == NULL) + if (!dev->sd_cx25840) dev_err(dev->dev, "cx25840 subdev registration failure\n"); cx25840_call(dev, core, load_fw); @@ -1171,7 +1171,7 @@ void cx231xx_card_setup(struct cx231xx *dev) tuner_i2c, "tuner", dev->tuner_addr, NULL); - if (dev->sd_tuner == NULL) + if (!dev->sd_tuner) dev_err(dev->dev, "tuner subdev registration failure\n"); else @@ -1190,7 +1190,7 @@ void cx231xx_card_setup(struct cx231xx *dev) }; struct eeprom *e = kzalloc(sizeof(*e), GFP_KERNEL); - if (e == NULL) { + if (!e) { dev_err(dev->dev, "failed to allocate memory to read eeprom\n"); break; @@ -1471,7 +1471,7 @@ static int cx231xx_init_v4l2(struct cx231xx *dev, dev->video_mode.num_alt); dev->video_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->video_mode.num_alt, GFP_KERNEL); - if (dev->video_mode.alt_max_pkt_size == NULL) + if (!dev->video_mode.alt_max_pkt_size) return -ENOMEM; for (i = 0; i < dev->video_mode.num_alt; i++) { @@ -1512,7 +1512,7 @@ static int cx231xx_init_v4l2(struct cx231xx *dev, /* compute alternate max packet sizes for vbi */ dev->vbi_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->vbi_mode.num_alt, GFP_KERNEL); - if (dev->vbi_mode.alt_max_pkt_size == NULL) + if (!dev->vbi_mode.alt_max_pkt_size) return -ENOMEM; for (i = 0; i < dev->vbi_mode.num_alt; i++) { @@ -1554,7 +1554,7 @@ static int cx231xx_init_v4l2(struct cx231xx *dev, dev->sliced_cc_mode.end_point_addr, dev->sliced_cc_mode.num_alt); dev->sliced_cc_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->sliced_cc_mode.num_alt, GFP_KERNEL); - if (dev->sliced_cc_mode.alt_max_pkt_size == NULL) + if (!dev->sliced_cc_mode.alt_max_pkt_size) return -ENOMEM; for (i = 0; i < dev->sliced_cc_mode.num_alt; i++) { @@ -1618,7 +1618,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface, /* allocate memory for our device state and initialize it */ dev = devm_kzalloc(&udev->dev, sizeof(*dev), GFP_KERNEL); - if (dev == NULL) { + if (!dev) { retval = -ENOMEM; goto err_if; } @@ -1748,7 +1748,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface, dev->ts1_mode.num_alt); dev->ts1_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->ts1_mode.num_alt, GFP_KERNEL); - if (dev->ts1_mode.alt_max_pkt_size == NULL) { + if (!dev->ts1_mode.alt_max_pkt_size) { retval = -ENOMEM; goto err_video_alt; } diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index d9f4ae50e869..76ce18cf2383 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -69,9 +69,9 @@ static DEFINE_MUTEX(cx231xx_devlist_mutex); */ void cx231xx_remove_from_devlist(struct cx231xx *dev) { - if (dev == NULL) + if (!dev) return; - if (dev->udev == NULL) + if (!dev->udev) return; if (atomic_read(&dev->devlist_count) > 0) { @@ -508,7 +508,7 @@ int cx231xx_set_video_alternate(struct cx231xx *dev) cx231xx_coredbg("minimum isoc packet size: %u (alt=%d)\n", min_pkt_size, dev->video_mode.alt); - if (dev->video_mode.alt_max_pkt_size != NULL) + if (dev->video_mode.alt_max_pkt_size) dev->video_mode.max_pkt_size = dev->video_mode.alt_max_pkt_size[dev->video_mode.alt]; cx231xx_coredbg("setting alternate %d with wMaxPacketSize=%u\n", @@ -539,7 +539,7 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) dev->current_pcb_config.hs_config_info[0].interface_info. ts1_index + 1; dev->ts1_mode.alt = alt; - if (dev->ts1_mode.alt_max_pkt_size != NULL) + if (dev->ts1_mode.alt_max_pkt_size) max_pkt_size = dev->ts1_mode.max_pkt_size = dev->ts1_mode.alt_max_pkt_size[dev->ts1_mode.alt]; break; @@ -553,7 +553,7 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) dev->current_pcb_config.hs_config_info[0].interface_info. audio_index + 1; dev->adev.alt = alt; - if (dev->adev.alt_max_pkt_size != NULL) + if (dev->adev.alt_max_pkt_size) max_pkt_size = dev->adev.max_pkt_size = dev->adev.alt_max_pkt_size[dev->adev.alt]; break; @@ -562,7 +562,7 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) dev->current_pcb_config.hs_config_info[0].interface_info. video_index + 1; dev->video_mode.alt = alt; - if (dev->video_mode.alt_max_pkt_size != NULL) + if (dev->video_mode.alt_max_pkt_size) max_pkt_size = dev->video_mode.max_pkt_size = dev->video_mode.alt_max_pkt_size[dev->video_mode. alt]; @@ -574,7 +574,7 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) dev->current_pcb_config.hs_config_info[0].interface_info. vanc_index + 1; dev->vbi_mode.alt = alt; - if (dev->vbi_mode.alt_max_pkt_size != NULL) + if (dev->vbi_mode.alt_max_pkt_size) max_pkt_size = dev->vbi_mode.max_pkt_size = dev->vbi_mode.alt_max_pkt_size[dev->vbi_mode.alt]; break; @@ -583,7 +583,7 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) dev->current_pcb_config.hs_config_info[0].interface_info. hanc_index + 1; dev->sliced_cc_mode.alt = alt; - if (dev->sliced_cc_mode.alt_max_pkt_size != NULL) + if (dev->sliced_cc_mode.alt_max_pkt_size) max_pkt_size = dev->sliced_cc_mode.max_pkt_size = dev->sliced_cc_mode.alt_max_pkt_size[dev-> sliced_cc_mode. @@ -768,7 +768,7 @@ int cx231xx_ep5_bulkout(struct cx231xx *dev, u8 *firmware, u16 size) u32 *buffer; buffer = kzalloc(4096, GFP_KERNEL); - if (buffer == NULL) + if (!buffer) return -ENOMEM; memcpy(&buffer[0], firmware, 4096); @@ -1009,7 +1009,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, cx231xx_uninit_isoc(dev); dma_q->p_left_data = kzalloc(4096, GFP_KERNEL); - if (dma_q->p_left_data == NULL) + if (!dma_q->p_left_data) return -ENOMEM; dev->video_mode.isoc_ctl.isoc_copy = isoc_copy; diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 248b62e2099c..0813f368fb3c 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -408,11 +408,10 @@ static int attach_xc5000(u8 addr, struct cx231xx *dev) int cx231xx_set_analog_freq(struct cx231xx *dev, u32 freq) { - if ((dev->dvb != NULL) && (dev->dvb->frontend != NULL)) { - + if (dev->dvb && dev->dvb->frontend) { struct dvb_tuner_ops *dops = &dev->dvb->frontend->ops.tuner_ops; - if (dops->set_analog_params != NULL) { + if (dops->set_analog_params) { struct analog_parameters params; params.frequency = freq; @@ -433,12 +432,10 @@ int cx231xx_reset_analog_tuner(struct cx231xx *dev) { int status = 0; - if ((dev->dvb != NULL) && (dev->dvb->frontend != NULL)) { - + if (dev->dvb && dev->dvb->frontend) { struct dvb_tuner_ops *dops = &dev->dvb->frontend->ops.tuner_ops; - if (dops->init != NULL && !dev->xc_fw_load_done) { - + if (dops->init && !dev->xc_fw_load_done) { dev_dbg(dev->dev, "Reloading firmware for XC5000\n"); status = dops->init(dev->dvb->frontend); @@ -635,8 +632,7 @@ static int dvb_init(struct cx231xx *dev) dev->dvb->frontend = dvb_attach(s5h1432_attach, &dvico_s5h1432_config, demod_i2c); - - if (dev->dvb->frontend == NULL) { + if (!dev->dvb->frontend) { dev_err(dev->dev, "Failed to attach s5h1432 front end\n"); result = -EINVAL; @@ -660,8 +656,7 @@ static int dvb_init(struct cx231xx *dev) dev->dvb->frontend = dvb_attach(s5h1411_attach, &xc5000_s5h1411_config, demod_i2c); - - if (dev->dvb->frontend == NULL) { + if (!dev->dvb->frontend) { dev_err(dev->dev, "Failed to attach s5h1411 front end\n"); result = -EINVAL; @@ -683,8 +678,7 @@ static int dvb_init(struct cx231xx *dev) dev->dvb->frontend = dvb_attach(s5h1432_attach, &dvico_s5h1432_config, demod_i2c); - - if (dev->dvb->frontend == NULL) { + if (!dev->dvb->frontend) { dev_err(dev->dev, "Failed to attach s5h1432 front end\n"); result = -EINVAL; @@ -707,8 +701,7 @@ static int dvb_init(struct cx231xx *dev) dev->dvb->frontend = dvb_attach(s5h1411_attach, &tda18271_s5h1411_config, demod_i2c); - - if (dev->dvb->frontend == NULL) { + if (!dev->dvb->frontend) { dev_err(dev->dev, "Failed to attach s5h1411 front end\n"); result = -EINVAL; @@ -734,8 +727,7 @@ static int dvb_init(struct cx231xx *dev) dev->dvb->frontend = dvb_attach(lgdt3305_attach, &hcw_lgdt3305_config, demod_i2c); - - if (dev->dvb->frontend == NULL) { + if (!dev->dvb->frontend) { dev_err(dev->dev, "Failed to attach LG3305 front end\n"); result = -EINVAL; @@ -768,7 +760,7 @@ static int dvb_init(struct cx231xx *dev) info.platform_data = &si2165_pdata; request_module(info.type); client = i2c_new_device(demod_i2c, &info); - if (client == NULL || client->dev.driver == NULL || dev->dvb->frontend == NULL) { + if (!client || !client->dev.driver || !dev->dvb->frontend) { dev_err(dev->dev, "Failed to attach SI2165 front end\n"); result = -EINVAL; @@ -815,7 +807,7 @@ static int dvb_init(struct cx231xx *dev) info.platform_data = &si2165_pdata; request_module(info.type); client = i2c_new_device(demod_i2c, &info); - if (client == NULL || client->dev.driver == NULL || dev->dvb->frontend == NULL) { + if (!client || !client->dev.driver || !dev->dvb->frontend) { dev_err(dev->dev, "Failed to attach SI2165 front end\n"); result = -EINVAL; @@ -853,7 +845,7 @@ static int dvb_init(struct cx231xx *dev) client = i2c_new_device( tuner_i2c, &info); - if (client == NULL || client->dev.driver == NULL) { + if (!client || !client->dev.driver) { dvb_frontend_detach(dev->dvb->frontend); result = -ENODEV; goto out_free; @@ -883,8 +875,7 @@ static int dvb_init(struct cx231xx *dev) &hauppauge_955q_lgdt3306a_config, demod_i2c ); - - if (dev->dvb->frontend == NULL) { + if (!dev->dvb->frontend) { dev_err(dev->dev, "Failed to attach LGDT3306A frontend.\n"); result = -EINVAL; @@ -912,7 +903,7 @@ static int dvb_init(struct cx231xx *dev) client = i2c_new_device( tuner_i2c, &info); - if (client == NULL || client->dev.driver == NULL) { + if (!client || !client->dev.driver) { dvb_frontend_detach(dev->dvb->frontend); result = -ENODEV; goto out_free; @@ -940,8 +931,7 @@ static int dvb_init(struct cx231xx *dev) dev->dvb->frontend = dvb_attach(mb86a20s_attach, &pv_mb86a20s_config, demod_i2c); - - if (dev->dvb->frontend == NULL) { + if (!dev->dvb->frontend) { dev_err(dev->dev, "Failed to attach mb86a20s demod\n"); result = -EINVAL; @@ -976,8 +966,7 @@ static int dvb_init(struct cx231xx *dev) request_module(info.type); client = i2c_new_device(demod_i2c, &info); - - if (client == NULL || client->dev.driver == NULL) { + if (!client || !client->dev.driver) { result = -ENODEV; goto out_free; } @@ -1005,8 +994,7 @@ static int dvb_init(struct cx231xx *dev) request_module(info.type); client = i2c_new_device(tuner_i2c, &info); - - if (client == NULL || client->dev.driver == NULL) { + if (!client || !client->dev.driver) { module_put(dvb->i2c_client_demod->dev.driver->owner); i2c_unregister_device(dvb->i2c_client_demod); result = -ENODEV; @@ -1042,8 +1030,7 @@ static int dvb_init(struct cx231xx *dev) request_module(info.type); client = i2c_new_device(demod_i2c, &info); - - if (client == NULL || client->dev.driver == NULL) { + if (!client || !client->dev.driver) { result = -ENODEV; goto out_free; } @@ -1071,7 +1058,7 @@ static int dvb_init(struct cx231xx *dev) dev->name); break; } - if (NULL == dvb->frontend) { + if (!dvb->frontend) { dev_err(dev->dev, "%s/2: frontend initialization failed\n", dev->name); result = -EINVAL; diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c b/drivers/media/usb/cx231xx/cx231xx-vbi.c index 9c27db16db2a..8ec53017da2b 100644 --- a/drivers/media/usb/cx231xx/cx231xx-vbi.c +++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c @@ -630,8 +630,7 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev, struct cx231xx_buffer *buf; buf = dev->vbi_mode.bulk_ctl.buf; - - if (buf == NULL) { + if (!buf) { /* first try to get the buffer */ get_next_vbi_buf(dma_q, &buf); @@ -654,8 +653,7 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, int offset, lencopy; buf = dev->vbi_mode.bulk_ctl.buf; - - if (buf == NULL) + if (!buf) return -EINVAL; p_out_buffer = videobuf_to_vmalloc(&buf->vb); diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 179b8481a870..956f8cbcb454 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -634,7 +634,7 @@ void cx231xx_reset_video_buffer(struct cx231xx *dev, else buf = dev->video_mode.bulk_ctl.buf; - if (buf == NULL) { + if (!buf) { /* first try to get the buffer */ get_next_buf(dma_q, &buf); @@ -663,7 +663,7 @@ int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, else buf = dev->video_mode.bulk_ctl.buf; - if (buf == NULL) + if (!buf) return -1; p_out_buffer = videobuf_to_vmalloc(&buf->vb);