All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Ravi Teja Darbha <ravi2j@gmail.com>
Cc: Larry.Finger@lwfinger.net, 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 09:59:01 +0530	[thread overview]
Message-ID: <20150630042901.GA13960@sudip-PC> (raw)
In-Reply-To: <5591A33B.8000209@gmail.com>

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

regards
sudip

  parent reply	other threads:[~2015-06-30  4:29 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 [this message]
2015-06-30  5:56   ` Larry Finger

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=20150630042901.GA13960@sudip-PC \
    --to=sudipm.mukherjee@gmail.com \
    --cc=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=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 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.