mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org, Archit Taneja <archit@ti.com>,
	Benoit Parrot <bparrot@ti.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] [media] ti-vpe: Adjust nine checks for null pointers
Date: Fri, 15 Sep 2017 20:45:53 +0200	[thread overview]
Message-ID: <1af449dd-d42d-bcf6-8f0c-7a8dc91dc928@users.sourceforge.net> (raw)
In-Reply-To: <8137a759-cbfd-e04d-0adb-06de1b3246d1@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Sep 2017 20:22:44 +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 <elfring@users.sourceforge.net>
---
 drivers/media/platform/ti-vpe/csc.c   |  2 +-
 drivers/media/platform/ti-vpe/vpdma.c |  2 +-
 drivers/media/platform/ti-vpe/vpe.c   | 14 +++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/ti-vpe/csc.c b/drivers/media/platform/ti-vpe/csc.c
index 135fc9993679..b6568e620a8d 100644
--- a/drivers/media/platform/ti-vpe/csc.c
+++ b/drivers/media/platform/ti-vpe/csc.c
@@ -181,7 +181,7 @@ struct csc_data *csc_create(struct platform_device *pdev, const char *res_name)
 
 	csc->res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
 						res_name);
-	if (csc->res == NULL) {
+	if (!csc->res) {
 		dev_err(&pdev->dev, "missing '%s' platform resources data\n",
 			res_name);
 		return ERR_PTR(-ENODEV);
diff --git a/drivers/media/platform/ti-vpe/vpdma.c b/drivers/media/platform/ti-vpe/vpdma.c
index e2cf2b90e500..b9acd29ebd9a 100644
--- a/drivers/media/platform/ti-vpe/vpdma.c
+++ b/drivers/media/platform/ti-vpe/vpdma.c
@@ -1145,7 +1145,7 @@ int vpdma_create(struct platform_device *pdev, struct vpdma_data *vpdma,
 	spin_lock_init(&vpdma->lock);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vpdma");
-	if (res == NULL) {
+	if (!res) {
 		dev_err(&pdev->dev, "missing platform resources data\n");
 		return -ENODEV;
 	}
diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c
index 45bd10544189..6bc210e68f6a 100644
--- a/drivers/media/platform/ti-vpe/vpe.c
+++ b/drivers/media/platform/ti-vpe/vpe.c
@@ -601,7 +601,7 @@ static void free_vbs(struct vpe_ctx *ctx)
 	struct vpe_dev *dev = ctx->dev;
 	unsigned long flags;
 
-	if (ctx->src_vbs[2] == NULL)
+	if (!ctx->src_vbs[2])
 		return;
 
 	spin_lock_irqsave(&dev->lock, flags);
@@ -1216,22 +1216,22 @@ static void device_run(void *priv)
 		 * It will be removed when using bottom field
 		 */
 		ctx->src_vbs[0] = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
-		WARN_ON(ctx->src_vbs[0] == NULL);
+		WARN_ON(!ctx->src_vbs[0]);
 	} else {
 		ctx->src_vbs[0] = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
-		WARN_ON(ctx->src_vbs[0] == NULL);
+		WARN_ON(!ctx->src_vbs[0]);
 	}
 
 	ctx->dst_vb = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
-	WARN_ON(ctx->dst_vb == NULL);
+	WARN_ON(!ctx->dst_vb);
 
 	if (ctx->deinterlacing) {
 
-		if (ctx->src_vbs[2] == NULL) {
+		if (!ctx->src_vbs[2]) {
 			ctx->src_vbs[2] = ctx->src_vbs[0];
-			WARN_ON(ctx->src_vbs[2] == NULL);
+			WARN_ON(!ctx->src_vbs[2]);
 			ctx->src_vbs[1] = ctx->src_vbs[0];
-			WARN_ON(ctx->src_vbs[1] == NULL);
+			WARN_ON(!ctx->src_vbs[1]);
 		}
 
 		/*
-- 
2.14.1

      parent reply	other threads:[~2017-09-15 18:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15 18:40 [PATCH 0/2] [media] TI-VPE: Adjustments for five function implementations SF Markus Elfring
2017-09-15 18:41 ` [PATCH 1/2] [media] ti-vpe: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-09-15 18:45 ` SF Markus Elfring [this message]

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=1af449dd-d42d-bcf6-8f0c-7a8dc91dc928@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=archit@ti.com \
    --cc=bparrot@ti.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /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

Powered by JetHome