Skip to contentSkip to conversation

Staging: gdm724x: Remove unnecessary print statements

PATCH In review Bhanusree Pola 2 participants 2 messages Mar 22, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: gdm724x: 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/gdm724x/gdm_lte.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/gdm724x/gdm_lte.c +0 -1
index 3c2aab7a921e..db11498f6fc7 100644
@@ -871,7 +871,6 @@ int register_lte_device(struct phy_dev *phy_dev,
 		net = alloc_netdev(sizeof(struct nic), pdn_dev_name,
 				   NET_NAME_UNKNOWN, ether_setup);
 		if (!net) {
-			pr_err("alloc_netdev failed\n");
 			ret = -ENOMEM;
 			goto err;
 		}
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Bhanusree Pola

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\)(...));

Quoted 7 lines

if(x==NULL)
{
...
(
-f(C,...);
|
-f(...,C);

You can also try just f(...,C,...). If you use that, the others are not needed, because ... can match nothing.

Quoted 6 lines

)
...
}
</smpl>

Quoted 26 lines
---
 drivers/staging/gdm724x/gdm_lte.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/gdm724x/gdm_lte.c +0 -2
index 3c2aab7a921e..db11498f6fc7 100644
@@ -871,7 +871,6 @@ int register_lte_device(struct phy_dev *phy_dev,
 		net = alloc_netdev(sizeof(struct nic), pdn_dev_name,
 				   NET_NAME_UNKNOWN, ether_setup);
 		if (!net) {
-			pr_err("alloc_netdev failed\n");
 			ret = -ENOMEM;
 			goto err;
 		}
--

2.17.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190322124010.7192-1-bhanusreemahesh%40gmail.com.
For more options, visit https://groups.google.com/d/optout.