All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: ks7010: Delete unnecessary return statement
@ 2016-10-07 21:54 Mihaela Muraru
  2016-10-08  6:04 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Mihaela Muraru @ 2016-10-07 21:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: outreachy-kernel

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;

}

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 8798b63..5ae013b 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: ks7010: Delete unnecessary return statement
  2016-10-07 21:54 [PATCH] Staging: ks7010: Delete unnecessary return statement Mihaela Muraru
@ 2016-10-08  6:04 ` Julia Lawall
  2016-10-08  7:00   ` Muraru Mihaela
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2016-10-08  6:04 UTC (permalink / raw)
  To: Mihaela Muraru; +Cc: Greg Kroah-Hartman, outreachy-kernel



On Sat, 8 Oct 2016, Mihaela Muraru wrote:

> 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;
>
> }

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

>
> Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
> ---
>  drivers/staging/ks7010/ks_hostif.c | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> index 8798b63..5ae013b 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: ks7010: Delete unnecessary return statement
  2016-10-08  6:04 ` [Outreachy kernel] " Julia Lawall
@ 2016-10-08  7:00   ` Muraru Mihaela
  2016-10-08  7:01     ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Muraru Mihaela @ 2016-10-08  7:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, outreachy-kernel

On Sat, Oct 08, 2016 at 08:04:58AM +0200, Julia Lawall wrote:
> 
> 
> On Sat, 8 Oct 2016, Mihaela Muraru wrote:
> 
> > 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;
> >
> > }
> 
> 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

> > Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
> > ---
> >  drivers/staging/ks7010/ks_hostif.c | 8 --------
> >  1 file changed, 8 deletions(-)
> >
> > diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> > index 8798b63..5ae013b 100644
> > --- a/drivers/staging/ks7010/ks_hostif.c
> > +++ b/drivers/staging/ks7010/ks_hostif.c
> > @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > 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.
> >


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: ks7010: Delete unnecessary return statement
  2016-10-08  7:00   ` Muraru Mihaela
@ 2016-10-08  7:01     ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2016-10-08  7:01 UTC (permalink / raw)
  To: Muraru Mihaela; +Cc: Greg Kroah-Hartman, outreachy-kernel



On Sat, 8 Oct 2016, Muraru Mihaela wrote:

> On Sat, Oct 08, 2016 at 08:04:58AM +0200, Julia Lawall wrote:
> >
> >
> > On Sat, 8 Oct 2016, Mihaela Muraru wrote:
> >
> > > 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;
> > >
> > > }
> >
> > 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.

Yes, that would be better, thanks.

julia

>
> mihaela
>
> > > Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
> > > ---
> > >  drivers/staging/ks7010/ks_hostif.c | 8 --------
> > >  1 file changed, 8 deletions(-)
> > >
> > > diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> > > index 8798b63..5ae013b 100644
> > > --- a/drivers/staging/ks7010/ks_hostif.c
> > > +++ b/drivers/staging/ks7010/ks_hostif.c
> > > @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> > > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > > 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-08  7:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-07 21:54 [PATCH] Staging: ks7010: Delete unnecessary return statement Mihaela Muraru
2016-10-08  6:04 ` [Outreachy kernel] " Julia Lawall
2016-10-08  7:00   ` Muraru Mihaela
2016-10-08  7:01     ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.