Skip to contentSkip to conversation

staging: rtl8188eu: remove unused define

PATCH New Sudip Mukherjee 1 participant 5 messages Jul 21, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 staging: rtl8188eu: remove unused define

_HCI_INTF_C_ was only defined here but not being used anywhere.

---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +0 -1
index 5490b29..f6c6f4a 100644
@@ -17,7 +17,6 @@
  *
  *
  ******************************************************************************/
-#define _HCI_INTF_C_
 
 #define pr_fmt(fmt) "R8188EU: " fmt
 #include <osdep_service.h>
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 2/5 staging: rtl8188eu: remove label

Directly return NULL instead of using another label and goto.

---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +2 -2
index f6c6f4a..09a918e 100644
@@ -66,7 +66,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
 
 	pdvobjpriv = kzalloc(sizeof(*pdvobjpriv), GFP_KERNEL);
 	if (pdvobjpriv == NULL)
-		goto exit;
+		return NULL;
 
 	pdvobjpriv->pusbintf = usb_intf;
 	pusbd = interface_to_usbdev(usb_intf);
@@ -121,7 +121,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
 		kfree(pdvobjpriv);
 		pdvobjpriv = NULL;
 	}
-exit:
+
 	return pdvobjpriv;
 }
 
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 3/5 staging: rtl8188eu: check for kzalloc failure

In reply to Sudip Mukherjee

Check for kzalloc failure and directly return from the error patch thus simplifying the success path.

---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +3 -4
index 09a918e..1c9558f 100644
@@ -114,13 +114,12 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
 	mutex_init(&pdvobjpriv->usb_vendor_req_mutex);
 	pdvobjpriv->usb_vendor_req_buf = kzalloc(MAX_USB_IO_CTL_SIZE, GFP_KERNEL);
 
-	if (pdvobjpriv->usb_vendor_req_buf) {
-		usb_get_dev(pusbd);
-	} else {
+	if (!pdvobjpriv->usb_vendor_req_buf) {
 		usb_set_intfdata(usb_intf, NULL);
 		kfree(pdvobjpriv);
-		pdvobjpriv = NULL;
+		return NULL;
 	}
+	usb_get_dev(pusbd);
 
 	return pdvobjpriv;
 }
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 4/5 staging: rtl8188eu: dont mix success and error path

In reply to Sudip Mukherjee

Success and error path was mixed. Separate them by directly returning 0 from the success path. In the process remove the variable which became unused.

---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +3 -5
index 1c9558f..29b7ea6 100644
@@ -474,7 +474,6 @@ static void rtw_usb_if1_deinit(struct adapter *if1)
 static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
 {
 	struct adapter *if1 = NULL;
-	int status = _FAIL;
 	struct dvobj_priv *dvobj;
 
 	RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_init\n"));
@@ -495,13 +494,12 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device
 
 	RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-871x_drv - drv_init, success!\n"));
 
-	status = _SUCCESS;
+	return 0;
 
 free_dvobj:
-	if (status != _SUCCESS)
-		usb_dvobj_deinit(pusb_intf);
+	usb_dvobj_deinit(pusb_intf);
 exit:
-	return status == _SUCCESS ? 0 : -ENODEV;
+	return -ENODEV;
 }
 
 /*
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH 5/5 staging: rtl8188eu: remove multiple blank line

In reply to Sudip Mukherjee

Multiple blank lines should be avoided.

---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +0 -4
index 29b7ea6..5f44c6a 100644
@@ -63,7 +63,6 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
 	struct usb_endpoint_descriptor	*pendp_desc;
 	struct usb_device	*pusbd;
 
-
 	pdvobjpriv = kzalloc(sizeof(*pdvobjpriv), GFP_KERNEL);
 	if (pdvobjpriv == NULL)
 		return NULL;
@@ -128,7 +127,6 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf)
 {
 	struct dvobj_priv *dvobj = usb_get_intfdata(usb_intf);
 
-
 	usb_set_intfdata(usb_intf, NULL);
 	if (dvobj) {
 		/* Modify condition for 92DU DMDP 2010.11.18, by Thomas */
@@ -326,7 +324,6 @@ exit:
 	pr_debug("<===  %s return %d.............. in %dms\n", __func__,
 		ret, rtw_get_passing_time_ms(start_time));
 
-
 	return ret;
 }
 
@@ -511,7 +508,6 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf)
 	struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
 	struct adapter *padapter = dvobj->if1;
 
-
 	pr_debug("+rtw_dev_remove\n");
 	RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+dev_remove()\n"));
 
Signature · 1 line
1.8.1.2