lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 30 Jun 2015 00:56:31 -0500
From:	Larry Finger <Larry.Finger@...inger.net>
To:	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Ravi Teja Darbha <ravi2j@...il.com>
CC:	florian.c.schilhabel@...glemail.com, gregkh@...uxfoundation.org,
	mahfouz.saif.elyazal@...il.com, vthakkar1994@...il.com,
	haggai.eran@...il.com, krinkin.m.u@...il.com,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rtl8712:Fix checkpatch warning

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ