public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Ravi Teja Darbha <ravi2j@gmail.com>
Cc: florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org,
	mahfouz.saif.elyazal@gmail.com, vthakkar1994@gmail.com,
	haggai.eran@gmail.com, krinkin.m.u@gmail.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtl8712:Fix checkpatch warning
Date: Tue, 30 Jun 2015 00:56:31 -0500	[thread overview]
Message-ID: <55922F8F.6010103@lwfinger.net> (raw)
In-Reply-To: <20150630042901.GA13960@sudip-PC>

On 06/29/2015 11:29 PM, Sudip Mukherjee wrote:
> On Tue, Jun 30, 2015 at 01:27:47AM +0530, Ravi Teja Darbha wrote:
>>
>> 1. Fix line over 80 characters warning.
>> 2. The checkpatch warning at line 499 seems to be false positive.
>> WARNING: else is not generally useful after a break or return
>> #499: FILE: rtl8712_recv.c:499:
>> +            return false;
>> +        else
>>
>> while(condition1) {
>>      if(condition2)
>>          foo();
>>      else if(condition3)
>>          return false;
>>      else
>>          break;
>> }
>>
>> The else condition here cannot be eliminated
> You can try something like this to eliminate the else:
>
> diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
> index fcb8c61..165161b 100644
> --- a/drivers/staging/rtl8712/rtl8712_recv.c
> +++ b/drivers/staging/rtl8712/rtl8712_recv.c
> @@ -492,12 +492,13 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,
>   	while (end_of_queue_search(phead, plist) == false) {
>   		pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u);
>   		pnextattrib = &pnextrframe->u.hdr.attrib;
> -		if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num))
> +		if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) {
>   			plist = plist->next;
> +			continue;
> +		}
>   		else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num))
>   			return false;
> -		else
> -			break;
> +		break;
>   	}
>   	list_del_init(&(prframe->u.hdr.list));
>   	list_add_tail(&(prframe->u.hdr.list), plist);

NACK on this idea. Checkpatch is not the complete arbiter of style. Just leave 
the code alone.

Larry



      reply	other threads:[~2015-06-30  5:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29 19:57 [PATCH] rtl8712:Fix checkpatch warning Ravi Teja Darbha
2015-06-29 20:09 ` Greg KH
2015-06-30  4:29 ` Sudip Mukherjee
2015-06-30  5:56   ` Larry Finger [this message]

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=55922F8F.6010103@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=florian.c.schilhabel@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haggai.eran@gmail.com \
    --cc=krinkin.m.u@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mahfouz.saif.elyazal@gmail.com \
    --cc=ravi2j@gmail.com \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=vthakkar1994@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