All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Konopko <kris@konagma.com>
To: Joe Perches <joe@perches.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	navin patidar <navin.patidar@gmail.com>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	trivial@kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtl8188eu: Remove unnecessary braces for simple return in xmit_linux.c
Date: Sun, 09 Nov 2014 09:38:03 +0000	[thread overview]
Message-ID: <545F35FB.20100@konagma.com> (raw)
In-Reply-To: <1415481824.23530.35.camel@perches.com>

On 08/11/14 21:23, Joe Perches wrote:
> On Sat, 2014-11-08 at 22:14 +0100, Krzysztof Konopko wrote:
>> scripts/checkpatch.pl reports a coding style problem in xmit_linux.c
> []
>> diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
> []
>> @@ -67,9 +67,8 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
>>  int rtw_endofpktfile(struct pkt_file *pfile)
>>  {
>>  
>> -	if (pfile->pkt_len == 0) {
>> +	if (pfile->pkt_len == 0)
>>  		return true;
>> -	}
>>  
>>
>>  	return false;
> 
> This should probably be
> 
> bool rtw_endofpktfile(const struct pkt_file *pfile_
> {
> 	return !pfile->pkt_len;
> }
>

Thanks for looking into it.

I see your point about making it a single return statement.  I tend to
shorten things as well.  I'd keep it as this:

bool rtw_endofpktfile(const struct pkt_file *pfile_
{
 	return pfile->pkt_len == 0;
}

Usign `!` operator suggests the variable is boolean although the name
suggests it isn't.  I'm not so familiar with the linux kernel code base
yet to justify it myself but I see no harm in making it slightly more
explicit.

> or just removed altogether and tested directly
> in the one place it's used.
> 
> 

It looks to me that the original intention was to open a possibility to
define the end of packet file in a OS dependent way so I'd leave it.

Or, if the counter argument is that non-Linux functionality should not
appear in this driver, the rest of non-Linux code should be removed in
the first place.  I'm not in position to even have an opinion on this.

The sole point of this patch was to fix a coding style problem but the
change you suggest seems still relevant.  I'll resend unless you have
strong objections on using `==` operator explicitly in the return statement.

Cheers,
Kris

  reply	other threads:[~2014-11-09  9:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-08 21:14 [PATCH] rtl8188eu: Remove unnecessary braces for simple return in xmit_linux.c Krzysztof Konopko
2014-11-08 21:23 ` Joe Perches
2014-11-09  9:38   ` Krzysztof Konopko [this message]
2014-11-10 18:54     ` [PATCH] rtl8188eu: Simplify rtw_endofpktfile() " Krzysztof Konopko

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=545F35FB.20100@konagma.com \
    --to=kris@konagma.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navin.patidar@gmail.com \
    --cc=trivial@kernel.org \
    /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.