Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753645AbbF3F4k (ORCPT ); Tue, 30 Jun 2015 01:56:40 -0400 Received: from mail-yk0-f178.google.com ([209.85.160.178]:36714 "EHLO mail-yk0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750953AbbF3F4f (ORCPT ); Tue, 30 Jun 2015 01:56:35 -0400 Message-ID: <55922F8F.6010103@lwfinger.net> Date: Tue, 30 Jun 2015 00:56:31 -0500 From: Larry Finger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Sudip Mukherjee , Ravi Teja Darbha 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 References: <5591A33B.8000209@gmail.com> <20150630042901.GA13960@sudip-PC> In-Reply-To: <20150630042901.GA13960@sudip-PC> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1882 Lines: 55 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/