mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] [media] TI-VPE: Adjustments for five function implementations
@ 2017-09-15 18:40 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 ` [PATCH 2/2] [media] ti-vpe: Adjust nine checks for null pointers SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-09-15 18:40 UTC (permalink / raw)
  To: linux-media, Archit Taneja, Benoit Parrot, Mauro Carvalho Chehab
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Sep 2017 20:30:40 +0200

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Delete an error message for a failed memory allocation in two functions
  Adjust nine checks for null pointers

 drivers/media/platform/ti-vpe/csc.c   |  6 ++----
 drivers/media/platform/ti-vpe/sc.c    |  4 +---
 drivers/media/platform/ti-vpe/vpdma.c |  2 +-
 drivers/media/platform/ti-vpe/vpe.c   | 14 +++++++-------
 4 files changed, 11 insertions(+), 15 deletions(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] [media] ti-vpe: Delete an error message for a failed memory allocation in two functions
  2017-09-15 18:40 [PATCH 0/2] [media] TI-VPE: Adjustments for five function implementations SF Markus Elfring
@ 2017-09-15 18:41 ` SF Markus Elfring
  2017-09-15 18:45 ` [PATCH 2/2] [media] ti-vpe: Adjust nine checks for null pointers SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-09-15 18:41 UTC (permalink / raw)
  To: linux-media, Archit Taneja, Benoit Parrot, Mauro Carvalho Chehab
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Sep 2017 20:15:17 +0200

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/ti-vpe/csc.c | 4 +---
 drivers/media/platform/ti-vpe/sc.c  | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/ti-vpe/csc.c b/drivers/media/platform/ti-vpe/csc.c
index 44b8465cf101..135fc9993679 100644
--- a/drivers/media/platform/ti-vpe/csc.c
+++ b/drivers/media/platform/ti-vpe/csc.c
@@ -176,8 +176,6 @@ struct csc_data *csc_create(struct platform_device *pdev, const char *res_name)
 	csc = devm_kzalloc(&pdev->dev, sizeof(*csc), GFP_KERNEL);
-	if (!csc) {
-		dev_err(&pdev->dev, "couldn't alloc csc_data\n");
+	if (!csc)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	csc->pdev = pdev;
 
diff --git a/drivers/media/platform/ti-vpe/sc.c b/drivers/media/platform/ti-vpe/sc.c
index e9273b713782..e9e307875feb 100644
--- a/drivers/media/platform/ti-vpe/sc.c
+++ b/drivers/media/platform/ti-vpe/sc.c
@@ -284,8 +284,6 @@ struct sc_data *sc_create(struct platform_device *pdev, const char *res_name)
 	sc = devm_kzalloc(&pdev->dev, sizeof(*sc), GFP_KERNEL);
-	if (!sc) {
-		dev_err(&pdev->dev, "couldn't alloc sc_data\n");
+	if (!sc)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	sc->pdev = pdev;
 
-- 
2.14.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] [media] ti-vpe: Adjust nine checks for null pointers
  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
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-09-15 18:45 UTC (permalink / raw)
  To: linux-media, Archit Taneja, Benoit Parrot, Mauro Carvalho Chehab
  Cc: LKML, kernel-janitors

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-15 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/2] [media] ti-vpe: Adjust nine checks for null pointers SF Markus Elfring

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