Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753690AbbF3E3o (ORCPT ); Tue, 30 Jun 2015 00:29:44 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33879 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459AbbF3E3M (ORCPT ); Tue, 30 Jun 2015 00:29:12 -0400 Date: Tue, 30 Jun 2015 09:59:01 +0530 From: Sudip Mukherjee To: Ravi Teja Darbha 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 Message-ID: <20150630042901.GA13960@sudip-PC> References: <5591A33B.8000209@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5591A33B.8000209@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1667 Lines: 50 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 -- 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/