Skip to contentSkip to conversation

remove unnecessary local variables

PATCH In review Himadri Pandya 3 participants 8 messages Mar 9, 2019 Staging

lore
Share & tools
lore
#0 lore raw

cover remove unnecessary local variables

This patchset removes unnecessary local variables from functions wilc_set_tx_power and wilc_get_tx_power.

Himadri Pandya (2):
staging: wilc1000: remove unnecessary variable ret
staging: wilc1000: remove unnecessary local variable

 drivers/staging/wilc1000/host_interface.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 staging: wilc1000: remove unnecessary variable ret

Remove unnecessary local variable "ret" and its assignments from function wilc_set_tx_power. Suggested by Coccinelle.

---
 drivers/staging/wilc1000/host_interface.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +1 -3
index fa0e1bd9f836..4a5f83ae06d2 100644
@@ -2119,7 +2119,6 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, u32 enabled, u32 count,
 
 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 {
-	int ret;
 	struct wid wid;
 
 	wid.id = WID_TX_POWER;
@@ -2127,10 +2126,9 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 	wid.val = &tx_power;
 	wid.size = sizeof(char);
 
-	ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
 				   wilc_get_vif_idx(vif));
 
-	return ret;
 }
 
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH 1/2] staging: wilc1000: remove unnecessary variable ret

Quoted 35 lines · Himadri Pandya

Remove unnecessary local variable "ret" and its assignments from function wilc_set_tx_power. Suggested by Coccinelle.

---
 drivers/staging/wilc1000/host_interface.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +1 -3
index fa0e1bd9f836..4a5f83ae06d2 100644
@@ -2119,7 +2119,6 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, u32 enabled, u32 count,
 
 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 {
-	int ret;
 	struct wid wid;
 
 	wid.id = WID_TX_POWER;
@@ -2127,10 +2126,9 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 	wid.val = &tx_power;
 	wid.size = sizeof(char);
 
-	ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
 				   wilc_get_vif_idx(vif));
 
-	return ret;
 }
 
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
Signature · 1 line
2.17.1

Your two patches do the same thing, but your wording is just a _little_ different. Why not make this just one patch that does that one thing, for two different functions?

thanks,

greg k-h

#3 lore raw

PATCH 1/1 staging: wilc1000: remove unnecessary local variables

In reply to Himadri Pandya

Remove unnecessary local variable "ret" and its assignments from functions wilc_set_tx_power and wilc_get_tx_power. Suggested by Coccinelle.

---
 drivers/staging/wilc1000/host_interface.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/host_interface.c +3 -9
index fa0e1bd9f836..76c73ef08eb2 100644
@@ -2119,7 +2119,6 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, u32 enabled, u32 count,
 
 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 {
-	int ret;
 	struct wid wid;
 
 	wid.id = WID_TX_POWER;
@@ -2127,15 +2126,12 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 	wid.val = &tx_power;
 	wid.size = sizeof(char);
 
-	ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
 				   wilc_get_vif_idx(vif));
-
-	return ret;
 }
 
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
 {
-	int ret;
 	struct wid wid;
 
 	wid.id = WID_TX_POWER;
@@ -2143,8 +2139,6 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
 	wid.val = tx_power;
 	wid.size = sizeof(char);
 
-	ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
-				   wilc_get_vif_idx(vif));
-
-	return ret;
+	return wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
+				    wilc_get_vif_idx(vif));
 }
Signature · 1 line
2.17.1
#4 lore raw

PATCH 2/2 staging: wilc1000: remove unnecessary local variable

In reply to Himadri Pandya

Remove unnecessary local variable "ret" and its assignments from function wilc_get_tx_power. Suggested by Coccinelle.

---
 drivers/staging/wilc1000/host_interface.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -4
index 4a5f83ae06d2..0a309a35c63e 100644
@@ -2133,7 +2133,6 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
 {
-	int ret;
 	struct wid wid;
 
 	wid.id = WID_TX_POWER;
@@ -2141,8 +2140,7 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
 	wid.val = tx_power;
 	wid.size = sizeof(char);
 
-	ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
-				   wilc_get_vif_idx(vif));
+	return wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
+				     wilc_get_vif_idx(vif));
 
-	return ret;
 }
Signature · 1 line
2.17.1
#5 lore raw
In reply to Himadri Pandya
Quoted 2 lines · Himadri Pandya

This patchset removes unnecessary local variables from functions wilc_set_tx_power and wilc_get_tx_power.

The concept is almost the same, so it could be just one patch.

When you resend, check that the arguments are properly placed and there are no blank lines at the end of the file.

julia

Quoted 18 lines

Himadri Pandya (2):
staging: wilc1000: remove unnecessary variable ret
staging: wilc1000: remove unnecessary local variable

 drivers/staging/wilc1000/host_interface.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

--
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/20190309110743.41443-1-himadri18.07%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

maintainer
#6 lore raw
In reply to Himadri Pandya
Quoted 9 lines · Himadri Pandya

This patchset removes unnecessary local variables from functions wilc_set_tx_power and wilc_get_tx_power.

Himadri Pandya (2):
staging: wilc1000: remove unnecessary variable ret
staging: wilc1000: remove unnecessary local variable

 drivers/staging/wilc1000/host_interface.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

The Subject: line of this email should also have the subsystem (staging) and driver (wilc1000), like your patches do. No need to change it this time, but please do so next time.

thanks,

greg k-h

#7 lore raw
Quoted 11 lines · Greg KH,
Quoted 9 lines · Himadri Pandya

This patchset removes unnecessary local variables from functions wilc_set_tx_power and wilc_get_tx_power.

Himadri Pandya (2):
staging: wilc1000: remove unnecessary variable ret
staging: wilc1000: remove unnecessary local variable

 drivers/staging/wilc1000/host_interface.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
Quoted 9 lines

The Subject: line of this email should also have the subsystem (staging) and driver (wilc1000), like your patches do. No need to change it this time, but please do so next time.

thanks,

greg k-h

Noted. Thank you.

- Himadri

Quoted 1 line