Skip to contentSkip to conversation

Staging: media: Remove unnecessary print statements

PATCH In review Bhanusree Pola 3 participants 3 messages Mar 22, 2019 – Mar 25, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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
index 6a1cee55a49b..2c5e3dd58cea 100644
@@ -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
maintainer Reviewed-by on v1 1/1
#1 lore raw
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>

---
 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
index 6a1cee55a49b..2c5e3dd58cea 100644
@@ -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 -3
 
 	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);
 

regards
Philipp

reviewer
#2 lore raw

Hi 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