[PATCH v3] staging: wlan-ng: Remove unnecessary parentheses

Tobin C. Harding me at tobin.cc
Wed Oct 18 21:40:08 UTC 2017


On Wed, Oct 18, 2017 at 11:48:21AM -0400, Frank A. Cancio Bello wrote:
> Remove unnecessary parentheses to comply with preferred coding style for
> the linux kernel and avoid the following checkpatch's messages:
> 'CHECK: Unnecessary parentheses around'
> 'CHECK: Logical continuations should be on the previous line'
> 
> Credits to checkpatch.
> 
> Signed-off-by: Frank A. Cancio Bello <frank at generalsoftwareinc.com>
> ---
> Changes in v3:
> 	* Exclude any parentheses removal that makes unclear the order of the operations.
> 
> Changes in v2:
> 	* I rewrote the log message to improve the style taking in consideration Julia's suggestions.
> 	* I merged in this patch similars changes that initially were in theirs own patch. I will reply that other patch email thread, saying to discard it, to avoid confussion.
> 
>  drivers/staging/wlan-ng/p80211req.c  |  2 +-
>  drivers/staging/wlan-ng/prism2fw.c   | 21 ++++++++++-----------
>  drivers/staging/wlan-ng/prism2mgmt.c | 23 +++++++++++------------
>  drivers/staging/wlan-ng/prism2sta.c  |  4 ++--
>  4 files changed, 24 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/p80211req.c b/drivers/staging/wlan-ng/p80211req.c
> index afe8477..0d1556c 100644
> --- a/drivers/staging/wlan-ng/p80211req.c
> +++ b/drivers/staging/wlan-ng/p80211req.c
> @@ -124,7 +124,7 @@ int p80211req_dorequest(struct wlandevice *wlandev, u8 *msgbuf)
>  
>  	/* Check Permissions */
>  	if (!capable(CAP_NET_ADMIN) &&
> -	    (msg->msgcode != DIDmsg_dot11req_mibget)) {
> +	    msg->msgcode != DIDmsg_dot11req_mibget) {

While this is not making the code _harder_ to read, it is not making it any easier either. So all
the change is really doing is quieting checkpatch. Usually it is not a good idea to make code
changes _just_ to quieten a static analysis tool. It's just a tool remember, there to help us write
better code.

On top of that CHECKS are just that, things that should be CHECK'ed, not necessarily fixed.

Hope this helps,
Tobin.


More information about the devel mailing list