Skip to contentSkip to conversation

staging: r8192U_core: Remove unnecessary check

PATCH In review Ioana Ciornei 3 participants 4 messages Mar 28, 2015 – Apr 1, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: r8192U_core: Remove unnecessary check

Remove unnecessary check since kfree() handles NULL pointers fine.

---
 drivers/staging/rtl8192u/r8192U_core.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/staging/rtl8192u/r8192U_core.c +4 -9
index 8834c23..bce44ba 100644
@@ -1724,10 +1724,8 @@ static void rtl8192_usb_deleteendpoints(struct net_device *dev)
 	}
 	kfree(priv->oldaddr);
 	priv->oldaddr = NULL;
-	if (priv->pp_rxskb) {
-		kfree(priv->pp_rxskb);
-		priv->pp_rxskb = NULL;
-	}
+	kfree(priv->pp_rxskb);
+	priv->pp_rxskb = NULL;
 }
 #else
 void rtl8192_usb_deleteendpoints(struct net_device *dev)
@@ -1752,11 +1750,8 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev)
 	priv->rx_urb = NULL;
 	kfree(priv->oldaddr);
 	priv->oldaddr = NULL;
-	if (priv->pp_rxskb) {
-		kfree(priv->pp_rxskb);
-		priv->pp_rxskb = 0;
-
-	}
+	kfree(priv->pp_rxskb);
+	priv->pp_rxskb = 0;
 
 #endif
 }
Signature · 1 line
1.9.1
#1 lore raw
Quoted 25 lines · Ioana Ciornei

Remove unnecessary check since kfree() handles NULL pointers fine.

---
 drivers/staging/rtl8192u/r8192U_core.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/staging/rtl8192u/r8192U_core.c +2 -4
index 8834c23..bce44ba 100644
@@ -1724,10 +1724,8 @@ static void rtl8192_usb_deleteendpoints(struct net_device *dev)
 	}
 	kfree(priv->oldaddr);
 	priv->oldaddr = NULL;
-	if (priv->pp_rxskb) {
-		kfree(priv->pp_rxskb);
-		priv->pp_rxskb = NULL;
-	}
+	kfree(priv->pp_rxskb);
+	priv->pp_rxskb = NULL;
 }
 #else
 void rtl8192_usb_deleteendpoints(struct net_device *dev)

drivers/staging/rtl8192u/r8192U_core.c void rtl8192_usb_deleteendpoints(struct net_device *dev) · line 1754

Quoted 10 lines
drivers/staging/rtl8192u/r8192U_core.c +2 -5
@@ -1752,11 +1750,8 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev)
 	priv->rx_urb = NULL;
 	kfree(priv->oldaddr);
 	priv->oldaddr = NULL;
-	if (priv->pp_rxskb) {
-		kfree(priv->pp_rxskb);
-		priv->pp_rxskb = 0;
-
-	}
+	kfree(priv->pp_rxskb);
+	priv->pp_rxskb = 0;

I guess it should be a separate change, but since priv->pp_rxskb is an argument to kfree it presumably has pointer type, and thus 0 should be NULL like in the other assignments above.

julia

#2 lore raw
Quoted 10 lines · Julia Lawall

Review

Quoted 8 lines · Ioana Ciornei

Remove unnecessary check since kfree() handles NULL pointers fine.

---
 drivers/staging/rtl8192u/r8192U_core.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/rtl8192u/r8192U_core.c

Quoted 4 lines

drivers/staging/rtl8192u/r8192U_core.c static void rtl8192_usb_deleteendpoints(struct

Quoted 4 lines

index 8834c23..bce44ba 100644

drivers/staging/rtl8192u/r8192U_core.c +0 -0
@@ -1724,10 +1724,8 @@ static void rtl8192_usb_deleteendpoints(struct

net_device *dev)

Quoted 5 lines
Quoted 5 lines
drivers/staging/rtl8192u/r8192U_core.c +0 -2
      }
      kfree(priv->oldaddr);
      priv->oldaddr = NULL;
-     if (priv->pp_rxskb) {
-             kfree(priv->pp_rxskb);
Quoted 8 lines

drivers/staging/rtl8192u/r8192U_core.c void rtl8192_usb_deleteendpoints(struct

Quoted 8 lines
drivers/staging/rtl8192u/r8192U_core.c +2 -2
-             priv->pp_rxskb = NULL;
-     }
+     kfree(priv->pp_rxskb);
+     priv->pp_rxskb = NULL;
 }
 #else
 void rtl8192_usb_deleteendpoints(struct net_device *dev)
@@ -1752,11 +1750,8 @@ void rtl8192_usb_deleteendpoints(struct

net_device *dev)

Quoted 11 lines

drivers/staging/rtl8192u/r8192U_core.c void rtl8192_usb_deleteendpoints(struct net_device *dev) · line 1754

Quoted 10 lines
drivers/staging/rtl8192u/r8192U_core.c +2 -5
      priv->rx_urb = NULL;
      kfree(priv->oldaddr);
      priv->oldaddr = NULL;
-     if (priv->pp_rxskb) {
-             kfree(priv->pp_rxskb);
-             priv->pp_rxskb = 0;
-
-     }
+     kfree(priv->pp_rxskb);
+     priv->pp_rxskb = 0;
Quoted 5 lines

I guess it should be a separate change, but since priv->pp_rxskb is an argument to kfree it presumably has pointer type, and thus 0 should be NULL like in the other assignments above.

julia

I noticed that too but saved it for another patch. I will send it too.

Ioana

maintainer
#3 lore raw
In reply to Ioana Ciornei
Quoted 6 lines · Ioana Ciornei

Remove unnecessary check since kfree() handles NULL pointers fine.

---
 drivers/staging/rtl8192u/r8192U_core.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

You sent me 5 patches for this driver, but no hint as to what order to apply them in. Please fix this by resending them as a patch series, properly numbered and threaded so that I know how to apply them.

thanks,

greg k-h