Skip to contentSkip to conversation

Staging: rtl8723au: Remove print statements and debug messages

PATCH New Bhumika Goyal 1 participant 1 message Feb 28, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: rtl8723au: Remove print statements and debug messages

The memory allocation functions generates a call stack containing all the context information on failure, so print statements and debug messages can be removed on failure of these functions. Also remove unwanted {} around if block after removal of these messages. Done using coccinelle:

@@
expression e,e1,e2;
identifier x;
@@
e=\(kmalloc\|kmalloc_array\|kzalloc\|
devm_kzalloc\)(...);
...when!=e=e1
if(!e)
-{
- \(printk\|DBG_8723A\|pr_err\|CERROR\|DBG_88E\)(...); (
goto x;
|
return e2;
|
return;
)
-}

@@
expression e,e1;
@@
e=\(kmalloc\|kmalloc_array\|kzalloc\|
devm_kzalloc\)(...);
...when!=e=e1
if(!e){
...
- \(DBG_8723A\|printk\|pr_err\|CERROR\|DBG_88E\)(...);
...
}

---
Changes in v2:
* Improve the semantic patch by including ... before the print statement.

 drivers/staging/rtl8723au/hal/usb_ops_linux.c     | 6 +-----
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 3 ---
 2 files changed, 1 insertion(+), 8 deletions(-)
drivers/staging/rtl8723au/hal/usb_ops_linux.c +1 -5
index 371e6b3..5c81ff4 100644
@@ -256,12 +256,8 @@ static void usb_read_interrupt_complete(struct urb *purb)
 				c2w = kmalloc(sizeof(struct evt_work),
 						GFP_ATOMIC);
 
-				if (!c2w) {
-					printk(KERN_WARNING "%s: unable to "
-					       "allocate work buffer\n",
-					       __func__);
+				if (!c2w)
 					goto urb_submit;
-				}
 
 				c2w->adapter = padapter;
 				INIT_WORK(&c2w->work, rtw_evt_work);
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +0 -3
index cf0daa1..722d5f5 100644
@@ -2608,8 +2608,6 @@ static int rtw_cfg80211_add_monitor_if(struct rtw_adapter *padapter, char *name,
 	/*  wdev */
 	mon_wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
 	if (!mon_wdev) {
-		DBG_8723A("%s(%s): allocate mon_wdev fail\n", __func__,
-			  padapter->pnetdev->name);
 		ret = -ENOMEM;
 		goto out;
 	}
@@ -3260,7 +3258,6 @@ int rtw_wdev_alloc(struct rtw_adapter *padapter, struct device *dev)
 	/*  wdev */
 	wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
 	if (!wdev) {
-		DBG_8723A("Couldn't allocate wireless device\n");
 		ret = -ENOMEM;
 		goto free_wiphy;
 	}
Signature · 1 line
1.9.1