Skip to contentSkip to conversation

Modify function return type and remove local return variable

PATCH In review Janani Ravichandran 2 participants 5 messages Feb 16, 2016 Staging

lore
Share & tools
lore
#0 lore raw

cover Modify function return type and remove local return variable

This patchset modifies return type of tcp_process() from int to void as the value returned is not used anywhere. Furthermore, the local variable used in the return statement in the function is not being initialised in all code paths. This variable has been removed as it is no longer necessary.

Janani Ravichandran (3):
staging: wilc1000: wilc_wlan.c: Modify return type of function
add_tcp_pending_ack()
staging: wilc1000: wilc_wlan.c: Remove local variable ret
staging: wilc1000: wilc_wlan.c: Remove empty else blocks.

 drivers/staging/wilc1000/wilc_wlan.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/3 staging: wilc1000: wilc_wlan.c: Modify return type of function tcp_process()

Change function header for tcp_process() to return void as the return value of type int is not used anywhere.

---
 drivers/staging/wilc1000/wilc_wlan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/wilc1000/wilc_wlan.c +1 -2
index a396ac9..c3ca662 100644
@@ -207,7 +207,7 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index,
 	return 0;
 }
 
-static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
+static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 {
 	int ret;
 	u8 *eth_hdr_ptr;
@@ -274,7 +274,6 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 		ret = 0;
 	}
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
-	return ret;
 }
 
 static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
Signature · 1 line
2.5.0
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/3] staging: wilc1000: wilc_wlan.c: Modify return type of function tcp_process()

Quoted 2 lines · Janani Ravichandran

Change function header for tcp_process() to return void as the return value of type int is not used anywhere.

Better squash all 3 patches here into one. It's easier to follow the change.

Quoted 36 lines
---
 drivers/staging/wilc1000/wilc_wlan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/wilc1000/wilc_wlan.c +1 -3
index a396ac9..c3ca662 100644
@@ -207,7 +207,7 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index,
        return 0;
 }
 
-static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
+static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 {
        int ret;
        u8 *eth_hdr_ptr;
@@ -274,7 +274,6 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
                ret = 0;
        }
        spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
-       return ret;
 }
 
 static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
--

2.5.0

--
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/49ebb18eea61eff1ad7c0c4183312ea7d25da46d.1455645880.git.janani.rvchndrn%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

PATCH 2/3 staging: wilc1000: wilc_wlan.c: Remove local variable ret

In reply to Janani Ravichandran

Remove local variable ret and all its initializations as it is no longer useful.

---
 drivers/staging/wilc1000/wilc_wlan.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/wilc_wlan.c +2 -3
index c3ca662..75b9bbb 100644
@@ -209,7 +209,6 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index,
 
 static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 {
-	int ret;
 	u8 *eth_hdr_ptr;
 	u8 *buffer = tqe->buffer;
 	unsigned short h_proto;
@@ -268,10 +267,10 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 			}
 
 		} else {
-			ret = 0;
+	
 		}
 	} else {
-		ret = 0;
+
 	}
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 }
Signature · 1 line
2.5.0
#4 lore raw

PATCH 3/3 staging: wilc1000: wilc_wlan.c: Remove empty else blocks.

In reply to Janani Ravichandran

Remove empty else blocks which are no longer necessary.

---
 drivers/staging/wilc1000/wilc_wlan.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/staging/wilc1000/wilc_wlan.c +0 -4
index 75b9bbb..e5471a7 100644
@@ -266,11 +266,7 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 				add_tcp_pending_ack(ack_no, i, tqe);
 			}
 
-		} else {
-	
 		}
-	} else {
-
 	}
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 }
Signature · 1 line
2.5.0