TI-VPE: Adjustments for five function implementations
Subsystems (2)
cover TI-VPE: Adjustments for five function implementations
From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.14.1
PATCH 1/2 ti-vpe: Delete an error message for a failed memory allocation in two functions
From: Markus Elfring <[email protected]>
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.
--- drivers/media/platform/ti-vpe/csc.c | 4 +--- drivers/media/platform/ti-vpe/sc.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/media/platform/ti-vpe/csc.c +1 -3
@@ -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;
drivers/media/platform/ti-vpe/sc.c +1 -3
@@ -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;
Signature · 1 line
2.14.1
PATCH 2/2 ti-vpe: Adjust nine checks for null pointers
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- 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(-)
drivers/media/platform/ti-vpe/csc.c +1 -1
@@ -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 );
drivers/media/platform/ti-vpe/vpdma.c +1 -1
@@ -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 ; }
drivers/media/platform/ti-vpe/vpe.c +7 -7
@@ -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 ]); }/*
Signature · 1 line
2.14.1