All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <jes.sorensen@gmail.com>
To: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>,
	 outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] Staging: rtl8192u: Reposition of return statements
Date: Fri, 20 Feb 2015 06:37:23 -0500	[thread overview]
Message-ID: <54E71C73.7090007@gmail.com> (raw)
In-Reply-To: <1424385500-22022-1-git-send-email-ksenija.stanojevic@gmail.com>

On 02/19/15 17:38, Ksenija Stanojevic wrote:
> This patch fixes the checkpatch.pl warning:
> WARNING: "else is not generally useful after a break or return"
> by placing return reg after if-else branch.
> 
> Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
> ---
>  drivers/staging/rtl8192u/r819xU_phy.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c
> index d006602..f343735 100644
> --- a/drivers/staging/rtl8192u/r819xU_phy.c
> +++ b/drivers/staging/rtl8192u/r819xU_phy.c
> @@ -355,13 +355,12 @@ u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
>  		bitshift =  rtl8192_CalculateBitShift(bitmask);
>  		reg = (reg & bitmask) >> bitshift;
>  		udelay(200);
> -		return reg;
>  	} else {
>  		reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr);
>  		bitshift =  rtl8192_CalculateBitShift(bitmask);
>  		reg = (reg & bitmask) >> bitshift;
> -		return reg;
>  	}
> +	return reg;
>  }
>  
>  /******************************************************************************
> 

In this case the automated commit message is actually a little unclear,
at least to me. Explaining that you are simplifying the code by not
having two identical paths would be better.

You could take this patch further as most of the code is identical
except for the udelay() in the first case.

Cheers,
Jes



  reply	other threads:[~2015-02-20 11:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 22:38 [PATCH] Staging: rtl8192u: Reposition of return statements Ksenija Stanojevic
2015-02-20 11:37 ` Jes Sorensen [this message]
2015-02-20 11:48   ` [Outreachy kernel] " Ksenija Stanojević
2015-02-20 11:50     ` Jes Sorensen

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=54E71C73.7090007@gmail.com \
    --to=jes.sorensen@gmail.com \
    --cc=ksenija.stanojevic@gmail.com \
    --cc=outreachy-kernel@googlegroups.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 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.