linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
	Hans Verkuil <hans.verkuil@cisco.com>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH resent 03/34] [media] DaVinci-VPBE: Adjust 16 checks for null pointers
Date: Wed, 12 Oct 2016 19:15:49 +0200	[thread overview]
Message-ID: <ea25141d-b337-94c8-970b-1289b8dfdefb@users.sourceforge.net> (raw)
In-Reply-To: <fdf72877-08a9-1a86-aec8-627a378258da@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 11 Oct 2016 13:37:10 +0200

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>
---

Another send try because of the following notification:

Mailer Daemon wrote on 2016-10-12 at 16:39:
> This message was created automatically by mail delivery software.
> 
> A message that you sent could not be delivered to one or more of
> its recipients. This is a permanent error. The following address(es)
> failed:
> 
> linux-kernel@vger.kernel.org:
> SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte
> r texts. BF:<H 0>; S1755378AbcJLOjE
> 
> linux-media@vger.kernel.org:
> SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte
> r texts. BF:<H 0>; S1755378AbcJLOjE
> 
> kernel-janitors@vger.kernel.org:
> SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte
> r texts. BF:<H 0>; S1755378AbcJLOjE


 drivers/media/platform/davinci/vpbe.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index b479747..496b27f 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -107,7 +107,7 @@ static int vpbe_find_encoder_sd_index(struct vpbe_config *cfg,
 static int vpbe_g_cropcap(struct vpbe_device *vpbe_dev,
 			  struct v4l2_cropcap *cropcap)
 {
-	if (NULL == cropcap)
+	if (!cropcap)
 		return -EINVAL;
 	cropcap->bounds.left = 0;
 	cropcap->bounds.top = 0;
@@ -149,7 +149,7 @@ static int vpbe_get_mode_info(struct vpbe_device *vpbe_dev, char *mode,
 	int curr_output = output_index;
 	int i;
 
-	if (NULL == mode)
+	if (!mode)
 		return -EINVAL;
 
 	for (i = 0; i < cfg->outputs[curr_output].num_modes; i++) {
@@ -166,7 +166,7 @@ static int vpbe_get_mode_info(struct vpbe_device *vpbe_dev, char *mode,
 static int vpbe_get_current_mode_info(struct vpbe_device *vpbe_dev,
 				      struct vpbe_enc_mode_info *mode_info)
 {
-	if (NULL == mode_info)
+	if (!mode_info)
 		return -EINVAL;
 
 	*mode_info = vpbe_dev->current_timings;
@@ -356,7 +356,7 @@ static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev,
 
 	ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video,
 					s_dv_timings, dv_timings);
-	if (!ret && (vpbe_dev->amp != NULL)) {
+	if (!ret && vpbe_dev->amp) {
 		/* Call amplifier subdevice */
 		ret = v4l2_subdev_call(vpbe_dev->amp, video,
 				s_dv_timings, dv_timings);
@@ -512,7 +512,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev,
 	int ret = 0;
 	int i;
 
-	if ((NULL == mode_info) || (NULL == mode_info->name))
+	if (!mode_info || !mode_info->name)
 		return -EINVAL;
 
 	for (i = 0; i < cfg->outputs[out_index].num_modes; i++) {
@@ -536,7 +536,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev,
 	}
 
 	/* Only custom timing should reach here */
-	if (preset_mode == NULL)
+	if (!preset_mode)
 		return -EINVAL;
 
 	mutex_lock(&vpbe_dev->lock);
@@ -570,9 +570,9 @@ static int platform_device_get(struct device *dev, void *data)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct vpbe_device *vpbe_dev = data;
 
-	if (strstr(pdev->name, "vpbe-osd") != NULL)
+	if (strstr(pdev->name, "vpbe-osd"))
 		vpbe_dev->osd_device = platform_get_drvdata(pdev);
-	if (strstr(pdev->name, "vpbe-venc") != NULL)
+	if (strstr(pdev->name, "vpbe-venc"))
 		vpbe_dev->venc_device = dev_get_platdata(&pdev->dev);
 
 	return 0;
@@ -606,7 +606,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
 	 * from the platform device by iteration of platform drivers and
 	 * matching with device name
 	 */
-	if (NULL == vpbe_dev || NULL == dev) {
+	if (!vpbe_dev || !dev) {
 		printk(KERN_ERR "Null device pointers.\n");
 		return -ENODEV;
 	}
@@ -652,7 +652,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
 	vpbe_dev->venc = venc_sub_dev_init(&vpbe_dev->v4l2_dev,
 					   vpbe_dev->cfg->venc.module_name);
 	/* register venc sub device */
-	if (vpbe_dev->venc == NULL) {
+	if (!vpbe_dev->venc) {
 		v4l2_err(&vpbe_dev->v4l2_dev,
 			"vpbe unable to init venc sub device\n");
 		ret = -ENODEV;
@@ -660,8 +660,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
 	}
 	/* initialize osd device */
 	osd_device = vpbe_dev->osd_device;
-
-	if (NULL != osd_device->ops.initialize) {
+	if (osd_device->ops.initialize) {
 		err = osd_device->ops.initialize(osd_device);
 		if (err) {
 			v4l2_err(&vpbe_dev->v4l2_dev,
@@ -679,7 +678,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
 	vpbe_dev->encoders = kmalloc_array(num_encoders,
 					   sizeof(*vpbe_dev->encoders),
 					   GFP_KERNEL);
-	if (NULL == vpbe_dev->encoders) {
+	if (!vpbe_dev->encoders) {
 		ret = -ENOMEM;
 		goto fail_dev_unregister;
 	}
@@ -715,7 +714,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
 	}
 	/* Add amplifier subdevice for dm365 */
 	if ((strcmp(vpbe_dev->cfg->module_name, "dm365-vpbe-display") == 0) &&
-			vpbe_dev->cfg->amp != NULL) {
+	   vpbe_dev->cfg->amp) {
 		amp_info = vpbe_dev->cfg->amp;
 		if (amp_info->is_i2c) {
 			vpbe_dev->amp = v4l2_i2c_new_subdev_board(
@@ -824,7 +823,7 @@ static int vpbe_probe(struct platform_device *pdev)
 	struct vpbe_config *cfg;
 	int ret = -EINVAL;
 
-	if (pdev->dev.platform_data == NULL) {
+	if (!pdev->dev.platform_data) {
 		v4l2_err(pdev->dev.driver, "No platform data\n");
 		return -ENODEV;
 	}
-- 
2.10.1


  parent reply	other threads:[~2016-10-12 17:17 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 14:26 [PATCH 00/34] [media] DaVinci-Video Processing: Fine-tuning for several function implementations SF Markus Elfring
2016-10-12 14:29 ` [PATCH 01/34] [media] DaVinci-VPBE: Use kmalloc_array() in vpbe_initialize() SF Markus Elfring
2016-10-12 14:30 ` [PATCH 02/34] [media] DaVinci-VPBE: Delete two error messages for a failed memory allocation SF Markus Elfring
2016-10-12 14:34 ` [PATCH 04/34] [media] DaVinci-VPBE: Combine substrings for four messages SF Markus Elfring
2016-10-12 14:35 ` [PATCH 05/34] [media] DaVinci-VPBE: Return an error code only as a constant in vpbe_probe() SF Markus Elfring
2016-10-12 14:40 ` [PATCH 06/34] [media] DaVinci-VPBE: Return an error code only by a single variable in vpbe_initialize() SF Markus Elfring
2016-11-16 14:30   ` Mauro Carvalho Chehab
2016-10-12 14:42 ` [PATCH 07/34] [media] DaVinci-VPBE: Delete an unnecessary variable initialisation " SF Markus Elfring
2016-11-16 14:35   ` Mauro Carvalho Chehab
2016-10-12 14:43 ` [PATCH 08/34] [media] DaVinci-VPBE: Return the success indication only as a constant in vpbe_set_mode() SF Markus Elfring
2016-10-12 14:44 ` [PATCH 09/34] [media] DaVinci-VPBE: Reduce the scope for a variable in vpbe_set_default_output() SF Markus Elfring
2016-10-12 14:47 ` [PATCH 10/34] [media] DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output() SF Markus Elfring
2016-11-03 12:20   ` Hans Verkuil
2016-11-03 20:54     ` SF Markus Elfring
2016-11-04  8:06       ` Hans Verkuil
2016-11-06 20:00         ` [PATCH v2 " SF Markus Elfring
2016-10-12 14:48 ` [PATCH 11/34] [media] DaVinci-VPBE: Rename a jump label " SF Markus Elfring
2016-10-12 14:50 ` [PATCH 12/34] [media] DaVinci-VPBE: Delete an unnecessary variable initialisation " SF Markus Elfring
2016-10-12 14:51 ` [PATCH 13/34] [media] DaVinci-VPFE-Capture: Use kmalloc_array() in vpfe_probe() SF Markus Elfring
2016-10-12 14:52 ` [PATCH 14/34] [media] DaVinci-VPFE-Capture: Delete three error messages for a failed memory allocation SF Markus Elfring
2016-10-12 14:53 ` [PATCH 15/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_probe() SF Markus Elfring
2016-10-12 14:54 ` [PATCH 16/34] [media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation " SF Markus Elfring
2016-10-12 14:55 ` [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input() SF Markus Elfring
2016-11-03 12:22   ` Hans Verkuil
2016-11-03 21:05     ` SF Markus Elfring
2016-11-04  8:06       ` Hans Verkuil
2016-11-06 21:00         ` [PATCH v2 17/34] [media] DaVinci-VPFE-Capture: Replace a memcpy() call by an assignment " SF Markus Elfring
2016-10-12 14:56 ` [PATCH 18/34] [media] DaVinci-VPFE-Capture: Combine substrings for an error message " SF Markus Elfring
2016-10-12 14:57 ` [PATCH 19/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_open() SF Markus Elfring
2016-10-12 14:58 ` [PATCH 20/34] [media] DaVinci-VPFE-Capture: Adjust 13 checks for null pointers SF Markus Elfring
2016-10-12 14:59 ` [PATCH 21/34] [media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in 11 functions SF Markus Elfring
2016-10-12 15:00 ` [PATCH 22/34] [media] DaVinci-VPFE-Capture: Move two assignments in vpfe_s_input() SF Markus Elfring
2016-10-12 15:01 ` [PATCH 23/34] [media] DaVinci-VPFE-Capture: Delete unnecessary braces in vpfe_isr() SF Markus Elfring
2016-10-12 15:02 ` [PATCH 24/34] [media] DaVinci-VPFE-Capture: Delete an unnecessary return statement in vpfe_unregister_ccdc_device() SF Markus Elfring
2016-10-12 15:03 ` [PATCH 25/34] [media] DaVinci-VPIF-Capture: Use kcalloc() in vpif_probe() SF Markus Elfring
2016-10-12 15:04 ` [PATCH 26/34] [media] DaVinci-VPIF-Capture: Delete an error message for a failed memory allocation SF Markus Elfring
2016-10-12 15:07 ` [PATCH 28/34] [media] DaVinci-VPIF-Capture: Delete an unnecessary variable initialisation in vpif_querystd() SF Markus Elfring
2016-10-12 15:08 ` [PATCH 29/34] [media] DaVinci-VPIF-Capture: Delete an unnecessary variable initialisation in vpif_channel_isr() SF Markus Elfring
2016-10-12 15:10 ` [PATCH 30/34] [media] DaVinci-VPIF-Display: Use kcalloc() in vpif_probe() SF Markus Elfring
2016-10-12 15:12 ` [PATCH 31/34] [media] DaVinci-VPIF-Display: Delete an error message for a failed memory allocation SF Markus Elfring
2016-10-12 15:13 ` [PATCH 32/34] [media] DaVinci-VPIF-Display: Adjust 11 checks for null pointers SF Markus Elfring
2016-10-12 15:14 ` [PATCH 33/34] [media] DaVinci-VPIF-Display: Delete an unnecessary variable initialisation in vpif_channel_isr() SF Markus Elfring
2016-10-12 15:15 ` [PATCH 34/34] [media] DaVinci-VPIF-Display: Delete an unnecessary variable initialisation in process_progressive_mode() SF Markus Elfring
     [not found] ` <fdf72877-08a9-1a86-aec8-627a378258da@users.sourceforge.net>
2016-10-12 17:15   ` SF Markus Elfring [this message]
     [not found] ` <73a8bc6c-3dc5-c152-7b59-fd1a5e84f61c@users.sourceforge.net>
2016-10-12 17:16   ` [PATCH resent 27/34] [media] DaVinci-VPIF-Capture: Adjust ten checks for null pointers SF Markus Elfring
2016-10-23 17:26 ` [PATCH 00/34] [media] DaVinci-Video Processing: Fine-tuning for several function implementations Lad, Prabhakar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea25141d-b337-94c8-970b-1289b8dfdefb@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=hans.verkuil@cisco.com \
    --cc=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).