Skip to contentSkip to conversation

staging: wilc1000: remove unnecessary variable result

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: wilc1000: remove unnecessary variable result

Remove unnecessary local variable "result" and its assignments from function wilc_set_pmkid_info. 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 4dd9a20f6a0b..962c5e6edd5e 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;
-	int result;
 
 	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = 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 result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 16 lines · Himadri Pandya

Remove unnecessary local variable "result" and its assignments from function wilc_set_pmkid_info. Suggested by Coccinelle.

---
 drivers/staging/wilc1000/host_interface.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +0 -0
index 4dd9a20f6a0b..962c5e6edd5e 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;

drivers/staging/wilc1000/host_interface.c int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, · line 1368

Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +1 -2
-	int result;
 
 	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = 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));

It looks like this now violates the rule that function arguments should appear just to the right of a (. Maybe checkpatch didn't check this because the line with the relevant argument is not affected by the change.

julia

Quoted 15 lines
drivers/staging/wilc1000/host_interface.c +0 -2
-	return result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
--

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

#2 lore raw
Quoted 34 lines · Julia Lawall,

Review

Quoted 9 lines · Himadri Pandya

Remove unnecessary local variable "result" and its assignments from function wilc_set_pmkid_info. Suggested by Coccinelle.

---
 drivers/staging/wilc1000/host_interface.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/wilc1000/host_interface.c

drivers/staging/wilc1000/host_interface.c int wilc_add_rx_gtk(struct wilc_vif *vif, const

Quoted 4 lines

index 4dd9a20f6a0b..962c5e6edd5e 100644

drivers/staging/wilc1000/host_interface.c +0 -0
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const

u8 *rx_gtk, u8 gtk_key_len,

drivers/staging/wilc1000/host_interface.c int wilc_add_rx_gtk(struct wilc_vif *vif, const · line 1358

Quoted 1 line
drivers/staging/wilc1000/host_interface.c +0 -0
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr

*pmkid)

drivers/staging/wilc1000/host_interface.c int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, · line 1368

Quoted 12 lines
drivers/staging/wilc1000/host_interface.c +1 -2
 {
      struct wid wid;
-     int result;
 
      wid.id = WID_PMKID_INFO;
      wid.type = WID_STR;
      wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
      wid.val = (u8 *)pmkid;
 
-     result = 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));
Quoted 6 lines

It looks like this now violates the rule that function arguments should appear just to the right of a (. Maybe checkpatch didn't check this because the line with the relevant argument is not affected by the change.

julia

In version 2, I aligned the parameters with opening parentheses, but still they appear on the left side in the patch. I double checked, parameters are properly aligned in the code.

- Himadri

Quoted 20 lines
Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +0 -2
-     return result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
--

2.17.1

--
You received this message because you are subscribed to the Google

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 2 lines

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/20190309094840.38154-1-himadri18.07%40gmail.com
.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.

#3 lore raw

PATCH v2 1/1 staging: wilc1000: remove unnecessary variable result

In reply to Himadri Pandya

Remove unnecessary local variable "result" and its assignments from function wilc_set_pmkid_info. Suggested by Coccinelle.

---
Changes in V2:
- Arrange the function arguments to the right of "(" in function
call in the return statement

drivers/staging/wilc1000/host_interface.c +2 -4
index 4dd9a20f6a0b..fa0e1bd9f836 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;
-	int result;
 
 	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
-				      wilc_get_vif_idx(vif));
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+				    wilc_get_vif_idx(vif));
 
-	return result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
---
 drivers/staging/wilc1000/host_interface.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -4
index 4dd9a20f6a0b..fa0e1bd9f836 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;
-	int result;
 
 	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
-				      wilc_get_vif_idx(vif));
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+				    wilc_get_vif_idx(vif));
 
-	return result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
Signature · 1 line
2.17.1
#4 lore raw
Quoted 66 lines · Himadri Pandya,

Remove unnecessary local variable "result" and its assignments from function wilc_set_pmkid_info. Suggested by Coccinelle.

---
Changes in V2:
- Arrange the function arguments to the right of "(" in function
call in the return statement

drivers/staging/wilc1000/host_interface.c +2 -4
index 4dd9a20f6a0b..fa0e1bd9f836 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8
 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr
 *pmkid)
 {
        struct wid wid;
-       int result;
 
        wid.id = WID_PMKID_INFO;
        wid.type = WID_STR;
        wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
        wid.val = (u8 *)pmkid;
 
-       result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
-                                     wilc_get_vif_idx(vif));
+       return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+                                   wilc_get_vif_idx(vif));
 
-       return result;
 }

int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)

---
 drivers/staging/wilc1000/host_interface.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -4
index 4dd9a20f6a0b..fa0e1bd9f836 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8
 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr
 *pmkid)
 {
        struct wid wid;
-       int result;
 
        wid.id = WID_PMKID_INFO;
        wid.type = WID_STR;
        wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
        wid.val = (u8 *)pmkid;
 
-       result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
-                                     wilc_get_vif_idx(vif));
+       return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+                                   wilc_get_vif_idx(vif));
 
-       return result;
 }
Quoted 4 lines

int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
--
2.17.1

The diff is appearing twice in the patch. So I'm resending the version 2.

Quoted 1 line
maintainer
#5 lore raw
In reply to Himadri Pandya
Quoted 64 lines · Himadri Pandya

Remove unnecessary local variable "result" and its assignments from function wilc_set_pmkid_info. Suggested by Coccinelle.

---
Changes in V2:
- Arrange the function arguments to the right of "(" in function
call in the return statement

drivers/staging/wilc1000/host_interface.c +2 -5
index 4dd9a20f6a0b..fa0e1bd9f836 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;
-	int result;
 
 	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
-				      wilc_get_vif_idx(vif));
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+				    wilc_get_vif_idx(vif));
 
-	return result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
---
 drivers/staging/wilc1000/host_interface.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -4
index 4dd9a20f6a0b..fa0e1bd9f836 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;
-	int result;
 
 	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
-				      wilc_get_vif_idx(vif));
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+				    wilc_get_vif_idx(vif));
 
-	return result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
Signature · 1 line
2.17.1

The same patch is included in this email twice :(

That's not going to go well when I try to apply it, please fix up and resend.

thanks,

greg k-h

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

Remove unnecessary local variable "result" and its assignments from function wilc_set_pmkid_info. Suggested by Coccinelle.

---
Changes in V2:
- Arrange the function arguments to the right of "(" in function
call in the return statement

drivers/staging/wilc1000/host_interface.c +0 -1
index 4dd9a20f6a0b..fa0e1bd9f836 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;
-	int result;
 
 	wid.id = WID_PMKID_INFO;

drivers/staging/wilc1000/host_interface.c int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, · line 1371

Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +2 -3
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
-				      wilc_get_vif_idx(vif));
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+				    wilc_get_vif_idx(vif));
 
-	return result;

The argument alignment looks fine. But you have left an empty blank line at the end of the function.

julia

Quoted 41 lines
drivers/staging/wilc1000/host_interface.c +0 -1
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
---
 drivers/staging/wilc1000/host_interface.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -5
index 4dd9a20f6a0b..fa0e1bd9f836 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;
-	int result;
 
 	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
-				      wilc_get_vif_idx(vif));
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+				    wilc_get_vif_idx(vif));
 
-	return result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
--

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

#7 lore raw

PATCH v2 1/1 staging: wilc1000: remove unnecessary variable result

In reply to Himadri Pandya

Remove unnecessary local variable "result" and its assignments from function wilc_set_pmkid_info. Suggested by Coccinelle.

---
Changes in V2:
- Arrange the function arguments to the right of "(" in function
call in the return statement

 drivers/staging/wilc1000/host_interface.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -4
index 4dd9a20f6a0b..fa0e1bd9f836 100644
@@ -1358,17 +1358,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;
-	int result;
 
 	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
-				      wilc_get_vif_idx(vif));
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+				    wilc_get_vif_idx(vif));
 
-	return result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
Signature · 1 line
2.17.1