diff mbox

megaraid_sas: fix missing { } braces

Message ID 1438614029-4257-1-git-send-email-colin.king@canonical.com (mailing list archive)
State New, archived
Headers show

Commit Message

Colin King Aug. 3, 2015, 3 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Static analysis by smatch indicated that there was a curly
braces issue:

drivers/scsi/megaraid/megaraid_sas_base.c:6139
  megasas_mgmt_fw_ioctl() warn: curly braces intended?

Add braces in the appropriate place so that kbuf_arr[i] gets
set to NULL only when we need to.  Also, remove whitespace
between kbuff_arr and [].

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Johannes Thumshirn Aug. 4, 2015, 6:47 a.m. UTC | #1
Hi Colin,

Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> Static analysis by smatch indicated that there was a curly
> braces issue:
>
> drivers/scsi/megaraid/megaraid_sas_base.c:6139
>   megasas_mgmt_fw_ioctl() warn: curly braces intended?
>
> Add braces in the appropriate place so that kbuf_arr[i] gets
> set to NULL only when we need to.  Also, remove whitespace
> between kbuff_arr and [].

I don't quite get where you removed that whitespace. Might it be a left
over from another version of the patch?

>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  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 71b884d..8face78 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -6131,12 +6131,13 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
>  	}
>  
>  	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);

For the curly braces part:
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

While you're up to it, care to check drivers/scsi/bfa as well? There was
a patch somewhen in the past but it seems it wasn't applied. But if
found this bugzilla entry
https://bugzilla.kernel.org/show_bug.cgi?id=98261
for it.

Thanks,
Johannes
diff mbox

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 71b884d..8face78 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -6131,12 +6131,13 @@  megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 	}
 
 	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);