Staging: media: Remove unnecessary print statements
PATCH 1/1 Staging: media: Remove unnecessary print statements
Remove print statements that provide information about error messages when memory allocation is failed.
Issue found using coccinelle
The following semantic patch is used to solve this:
<smpl>
@@
expression x;
constant char[] C;
identifier f;
@@
x = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\| usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\)(...));
if(x==NULL)
{
...
(
-f(C,...);
|
-f(...,C);
)
...
}
</smpl>
--- drivers/staging/media/imx/imx6-mipi-csi2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/media/imx/imx6-mipi-csi2.c +1 -3
@@ -628,10 +628,8 @@ static int csi2_probe(struct platform_device *pdev) } csi2->base =devm_ioremap (&pdev->dev, res->start,PAGE_SIZE ); -if (!csi2->base) { -v4l2_err (&csi2->sd,"failed to map CSI-2 registers\n" ); +if (!csi2->base)return -ENOMEM ; - }mutex_init (&csi2->lock);
Signature · 1 line
2.17.1
Quoted 2 lines · Bhanusree Pola
Remove print statements that provide information about error messages when memory allocation is failed.
It would be nice to mention that these functions already print error messages themselves, but the patch is fine.
Quoted 37 lines
Issue found using coccinelle
The following semantic patch is used to solve this:<smpl>
@@
expression x;
constant char[] C;
identifier f;
@@x = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\| usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\)(...));
if(x==NULL)
{
...
(
-f(C,...);Quoted 1 line
-f(...,C);
)
...
}
</smpl>Signed-off-by Bhanusree Pola <[email protected]>--- drivers/staging/media/imx/imx6-mipi-csi2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/media/imx/imx6-mipi-csi2.c +0
-0@@ -628,10 +628,8 @@ static int csi2_probe(struct platform_device *pdev) }
drivers/staging/media/imx/imx6-mipi-csi2.c static int csi2_probe(struct platform_device *pdev) · line 635
Quoted 10 lines
drivers/staging/media/imx/imx6-mipi-csi2.c +1
-3csi2->base =devm_ioremap (&pdev->dev, res->start,PAGE_SIZE ); -if (!csi2->base) { -v4l2_err (&csi2->sd,"failed to map CSI-2 registers\n" ); +if (!csi2->base)return -ENOMEM ; - }mutex_init (&csi2->lock);
regards
Philipp
Fabio Estevam
reviewerHi Bhanusree,
Quoted 2 lines · Philipp Zabel
It would be nice to mention that these functions already print error messages themselves, but the patch is fine.
One other suggestion is to try to improve the Subject: it is recommended to put the driver name, so something like:
media: imx: mipi csi-2: Remove unnecessary error messages
Thanks