public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: forest@alittletooquiet.net, madhumithabiw@gmail.com,
	brandonbonaby94@gmail.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: vt6655: Change return type of function and remove variable
Date: Thu, 30 May 2019 14:15:13 -0700	[thread overview]
Message-ID: <20190530211513.GA25966@kroah.com> (raw)
In-Reply-To: <20190529134529.8481-1-nishkadg.linux@gmail.com>

On Wed, May 29, 2019 at 07:15:29PM +0530, Nishka Dasgupta wrote:
> As the function CARDbRadioPowerOff always returns true, and this value
> does not appear to be used anywhere, the return variable can be entirely
> removed and the function converted to type void.
> Issue found with Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
>  drivers/staging/vt6655/card.c | 56 ++++++++++++++++-------------------
>  drivers/staging/vt6655/card.h |  2 +-
>  2 files changed, 27 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
> index 6ecbe925026d..2aca5b38be5c 100644
> --- a/drivers/staging/vt6655/card.c
> +++ b/drivers/staging/vt6655/card.c
> @@ -409,42 +409,38 @@ bool CARDbSetBeaconPeriod(struct vnt_private *priv,
>   *  Out:
>   *      none
>   *
> - * Return Value: true if success; otherwise false
> + * Return Value: none

That's obvious and the whole line can be removed.

>   */
> -bool CARDbRadioPowerOff(struct vnt_private *priv)
> +void CARDbRadioPowerOff(struct vnt_private *priv)
>  {
> -	bool bResult = true;
> -
> -	if (priv->bRadioOff)
> -		return true;
> -
> -	switch (priv->byRFType) {
> -	case RF_RFMD2959:
> -		MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL,
> -				   SOFTPWRCTL_TXPEINV);
> -		MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL,
> -				  SOFTPWRCTL_SWPE1);
> -		break;
> +	if (!priv->bRadioOff) {
> +		switch (priv->byRFType) {

No, don't do that.  Leave the indentation alone and just return "early"
like the code did.

thanks,

greg k-h

  reply	other threads:[~2019-05-30 21:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 13:45 [PATCH] staging: vt6655: Change return type of function and remove variable Nishka Dasgupta
2019-05-30 21:15 ` Greg KH [this message]
2019-05-31 17:32   ` [PATCH v2] " Nishka Dasgupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190530211513.GA25966@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=brandonbonaby94@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=forest@alittletooquiet.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madhumithabiw@gmail.com \
    --cc=nishkadg.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox