Skip to contentSkip to conversation

Staging: ks7010: Delete unnecessary return statement

PATCH Superseded Mihaela Muraru 2 participants 4 messages Oct 7, 2016 – Oct 8, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: ks7010: Delete unnecessary return statement

This is a patch to ks_hostif.c file that fixes up a checkpatch.pl

WARNING: void function return statements are not generally useful.

The 'return' statement is not useful here, because it is not necessary to be forced the exit of the function.

Like in this example:

void funct() {

	if(condition) return;

	//do something;

}

---
 drivers/staging/ks7010/ks_hostif.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -8
index 8798b63..5ae013b 100644
@@ -1933,7 +1933,6 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
 		break;
 	}
 
-	return;
 }
 
 struct wpa_suite_t {
@@ -2122,7 +2121,6 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 		break;
 
 	}
-	return;
 }
 
 static
@@ -2236,7 +2234,6 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv)
 		break;
 	}
 
-	return;
 }
 
 static
@@ -2337,7 +2334,6 @@ void hostif_sme_powermgt_set(struct ks_wlan_private *priv)
 	}
 	hostif_power_mngmt_request(priv, mode, wake_up, receiveDTIMs);
 
-	return;
 }
 
 static
@@ -2355,7 +2351,6 @@ void hostif_sme_sleep_set(struct ks_wlan_private *priv)
 		break;
 	}
 
-	return;
 }
 
 static
@@ -2413,7 +2408,6 @@ void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
 				       &priv->wpa.key[2].rx_seq[0]);
 		break;
 	}
-	return;
 }
 
 static
@@ -2649,7 +2643,6 @@ void hostif_sme_task(unsigned long dev)
 				tasklet_schedule(&priv->sme_task);
 		}
 	}
-	return;
 }
 
 /* send to Station Management Entity module */
@@ -2733,5 +2726,4 @@ int hostif_init(struct ks_wlan_private *priv)
 void hostif_exit(struct ks_wlan_private *priv)
 {
 	tasklet_kill(&priv->sme_task);
-	return;
 }
Signature · 1 line
2.7.4
#1 lore raw
Quoted 9 lines · Mihaela Muraru

This is a patch to ks_hostif.c file that fixes up a checkpatch.pl

WARNING: void function return statements are not generally useful.

The 'return' statement is not useful here, because it is not necessary to be forced the exit of the function.

Like in this example:

Quoted 7 lines

void funct() {

	if(condition) return;

	//do something;

}

The patch is OK, but I don't understand what you mean by thi example. This looks like a case where the return cannot be removed.

julia

Quoted 82 lines
---
 drivers/staging/ks7010/ks_hostif.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -9
index 8798b63..5ae013b 100644
@@ -1933,7 +1933,6 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
 		break;
 	}
 
-	return;
 }
 
 struct wpa_suite_t {
@@ -2122,7 +2121,6 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 		break;
 
 	}
-	return;
 }
 
 static
@@ -2236,7 +2234,6 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv)
 		break;
 	}
 
-	return;
 }
 
 static
@@ -2337,7 +2334,6 @@ void hostif_sme_powermgt_set(struct ks_wlan_private *priv)
 	}
 	hostif_power_mngmt_request(priv, mode, wake_up, receiveDTIMs);
 
-	return;
 }
 
 static
@@ -2355,7 +2351,6 @@ void hostif_sme_sleep_set(struct ks_wlan_private *priv)
 		break;
 	}
 
-	return;
 }
 
 static
@@ -2413,7 +2408,6 @@ void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
 				       &priv->wpa.key[2].rx_seq[0]);
 		break;
 	}
-	return;
 }
 
 static
@@ -2649,7 +2643,6 @@ void hostif_sme_task(unsigned long dev)
 				tasklet_schedule(&priv->sme_task);
 		}
 	}
-	return;
 }
 
 /* send to Station Management Entity module */
@@ -2733,5 +2726,4 @@ int hostif_init(struct ks_wlan_private *priv)
 void hostif_exit(struct ks_wlan_private *priv)
 {
 	tasklet_kill(&priv->sme_task);
-	return;
 }
--

2.7.4

--
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/20161007215439.GA15407%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 17 lines · Julia Lawall
Quoted 13 lines · Mihaela Muraru

This is a patch to ks_hostif.c file that fixes up a checkpatch.pl

WARNING: void function return statements are not generally useful.

The 'return' statement is not useful here, because it is not necessary to be forced the exit of the function.

Like in this example:

void funct() {

	if(condition) return;
Quoted 8 lines
Quoted 3 lines
	//do something;

}

The patch is OK, but I don't understand what you mean by thi example. This looks like a case where the return cannot be removed.

julia

Thank you for reply.

It is an example when we can use 'return' from a void function, but now I think that is too much information and I will send patch v2 without it.

mihaela

Quoted 81 lines
Quoted 81 lines
---
 drivers/staging/ks7010/ks_hostif.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -9
index 8798b63..5ae013b 100644
@@ -1933,7 +1933,6 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
 		break;
 	}
 
-	return;
 }
 
 struct wpa_suite_t {
@@ -2122,7 +2121,6 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 		break;
 
 	}
-	return;
 }
 
 static
@@ -2236,7 +2234,6 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv)
 		break;
 	}
 
-	return;
 }
 
 static
@@ -2337,7 +2334,6 @@ void hostif_sme_powermgt_set(struct ks_wlan_private *priv)
 	}
 	hostif_power_mngmt_request(priv, mode, wake_up, receiveDTIMs);
 
-	return;
 }
 
 static
@@ -2355,7 +2351,6 @@ void hostif_sme_sleep_set(struct ks_wlan_private *priv)
 		break;
 	}
 
-	return;
 }
 
 static
@@ -2413,7 +2408,6 @@ void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
 				       &priv->wpa.key[2].rx_seq[0]);
 		break;
 	}
-	return;
 }
 
 static
@@ -2649,7 +2643,6 @@ void hostif_sme_task(unsigned long dev)
 				tasklet_schedule(&priv->sme_task);
 		}
 	}
-	return;
 }
 
 /* send to Station Management Entity module */
@@ -2733,5 +2726,4 @@ int hostif_init(struct ks_wlan_private *priv)
 void hostif_exit(struct ks_wlan_private *priv)
 {
 	tasklet_kill(&priv->sme_task);
-	return;
 }
--

2.7.4

--
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/20161007215439.GA15407%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 25 lines · Muraru Mihaela
Quoted 24 lines · Julia Lawall
Quoted 9 lines · Mihaela Muraru

This is a patch to ks_hostif.c file that fixes up a checkpatch.pl

WARNING: void function return statements are not generally useful.

The 'return' statement is not useful here, because it is not necessary to be forced the exit of the function.

Like in this example:

Quoted 7 lines

void funct() {

	if(condition) return;

	//do something;

}

The patch is OK, but I don't understand what you mean by thi example. This looks like a case where the return cannot be removed.

Quoted 7 lines
Quoted 1 line

julia

Thank you for reply.

It is an example when we can use 'return' from a void function, but now I think that is too much information and I will send patch v2 without it.

Yes, that would be better, thanks.

julia

Quoted 92 lines

mihaela

Quoted 74 lines
Quoted 74 lines
---
 drivers/staging/ks7010/ks_hostif.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -9
index 8798b63..5ae013b 100644
@@ -1933,7 +1933,6 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
 		break;
 	}
 
-	return;
 }
 
 struct wpa_suite_t {
@@ -2122,7 +2121,6 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 		break;
 
 	}
-	return;
 }
 
 static
@@ -2236,7 +2234,6 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv)
 		break;
 	}
 
-	return;
 }
 
 static
@@ -2337,7 +2334,6 @@ void hostif_sme_powermgt_set(struct ks_wlan_private *priv)
 	}
 	hostif_power_mngmt_request(priv, mode, wake_up, receiveDTIMs);
 
-	return;
 }
 
 static
@@ -2355,7 +2351,6 @@ void hostif_sme_sleep_set(struct ks_wlan_private *priv)
 		break;
 	}
 
-	return;
 }
 
 static
@@ -2413,7 +2408,6 @@ void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
 				       &priv->wpa.key[2].rx_seq[0]);
 		break;
 	}
-	return;
 }
 
 static
@@ -2649,7 +2643,6 @@ void hostif_sme_task(unsigned long dev)
 				tasklet_schedule(&priv->sme_task);
 		}
 	}
-	return;
 }
 
 /* send to Station Management Entity module */
@@ -2733,5 +2726,4 @@ int hostif_init(struct ks_wlan_private *priv)
 void hostif_exit(struct ks_wlan_private *priv)
 {
 	tasklet_kill(&priv->sme_task);
-	return;
 }
--

2.7.4

Quoted 7 lines
Quoted 7 lines

--
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/20161007215439.GA15407%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.

--
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/20161008070001.GA2695%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.