Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1357352

Re: [PATCH 3/3] megaraid_sas: add missing curly braces in ioctl handler

From Hannes Reinecke <hare@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] megaraid_sas: add missing curly braces in ioctl handler
Date 2016-03-14 16:30 +0100
Message-ID <rcCBs-5C6-3@gated-at.bofh.it> (permalink)
References <rcBP3-4Xz-9@gated-at.bofh.it> <rcBP4-4Xz-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 03/14/2016 03:29 PM, Arnd Bergmann wrote:
> gcc-6 found a dubious indentation in the megasas_mgmt_fw_ioctl
> function:
> 
> drivers/scsi/megaraid/megaraid_sas_base.c: In function 'megasas_mgmt_fw_ioctl':
> drivers/scsi/megaraid/megaraid_sas_base.c:6658:4: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
>     kbuff_arr[i] = NULL;
>     ^~~~~~~~~
> drivers/scsi/megaraid/megaraid_sas_base.c:6653:3: note: ...this 'if' clause, but it is not
>    if (kbuff_arr[i])
>    ^~
> 
> The code is actually correct, as there is no downside in clearing a NULL
> pointer again.
> 
> This clarifies the code and avoids the warning by adding extra curly
> braces.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 90dc9d98f01b ("megaraid_sas : MFI MPT linked list corruption fix")
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 5c08568ccfbf..2627200d4f82 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -6650,12 +6650,13 @@ out:
>  	}
>  
>  	for (i = 0; i < ioc->sge_count; i++) {
> -		if (kbuff_arr[i])
> +		if (kbuff_arr[i]) {
>  			dma_free_coherent(&instance->pdev->dev,
>  					  le32_to_cpu(kern_sge32[i].length),
>  					  kbuff_arr[i],
>  					  le32_to_cpu(kern_sge32[i].phys_addr));
>  			kbuff_arr[i] = NULL;
> +		}
>  	}
>  
>  	megasas_return_cmd(instance, cmd);
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3/3] megaraid_sas: add missing curly braces in ioctl handler Arnd Bergmann <arnd@arndb.de> - 2016-03-14 15:40 +0100
  Re: [PATCH 3/3] megaraid_sas: add missing curly braces in ioctl  handler Hannes Reinecke <hare@suse.de> - 2016-03-14 16:30 +0100
  RE: [PATCH 3/3] megaraid_sas: add missing curly braces in ioctl handler Sumit Saxena <sumit.saxena@broadcom.com> - 2016-03-15 12:10 +0100

csiph-web