Re: [PATCH 04/10] staging: ks7010: fix checkpatch BRACES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 21, 2017 at 01:37:06PM +1100, Tobin C. Harding wrote:
> Checkpatch emits CHECK: Unbalanced braces around else
> statement. Statements in question are single statements so we do not
> need braces. Checkpatch also warns about multiple line dereference for
> this code.
> 
> Fix if/else/else if statement use of braces. Fix function argument layout
> at the same time since it is the same statement.
> 
> Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
> ---
>  drivers/staging/ks7010/ks_hostif.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> index db10e16..68e26f4 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -2456,19 +2456,15 @@ void hostif_sme_execute(struct ks_wlan_private *priv, int event)
>  		hostif_phy_information_request(priv);
>  		break;
>  	case SME_MIC_FAILURE_REQUEST:
> -		if (priv->wpa.mic_failure.failure == 1) {
> -			hostif_mic_failure_request(priv,
> -						   priv->wpa.mic_failure.
> -						   failure - 1, 0);
> -		} else if (priv->wpa.mic_failure.failure == 2) {
> -			hostif_mic_failure_request(priv,
> -						   priv->wpa.mic_failure.
> -						   failure - 1,
> -						   priv->wpa.mic_failure.
> -						   counter);
> -		} else
> -			DPRINTK(4,
> -				"SME_MIC_FAILURE_REQUEST: failure count=%u error?\n",
> +		if (priv->wpa.mic_failure.failure == 1)
> +			hostif_mic_failure_request(
> +				priv, priv->wpa.mic_failure.failure - 1, 0);
> +		else if (priv->wpa.mic_failure.failure == 2)
> +			hostif_mic_failure_request(
> +				priv, priv->wpa.mic_failure.failure - 1,
> +				priv->wpa.mic_failure.counter);
> +		else
> +			DPRINTK(4, "SME_MIC_FAILURE_REQUEST: failure count=%u error?\n",
>  				priv->wpa.mic_failure.failure);

No.  This isn't nice.

Multi-line indents get curly braces generally for readability.  It's
better to go over the 80 character limit here.


		if (priv->wpa.mic_failure.failure == 1) {
			hostif_mic_failure_request(priv,
						   priv->wpa.mic_failure.failure - 1,
						   0);
		} else if priv->wpa.mic_failure.failure == 2) {
			hostif_mic_failure_request(priv,
						   priv->wpa.mic_failure.failure - 1,
						   priv->wpa.mic_failure.counter);
		} else {
			DPRINTK(4, "SME_MIC_FAILURE_REQUEST: failure count=%u error?\n",
				priv->wpa.mic_failure.failure);
		}

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux