summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Chancellor <natechancellor@gmail.com>2019-03-08 00:18:39 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2019-03-26 03:22:44 +0100
commit3e14592da654d53d87987aa09753d5a26e45446f (patch)
tree19d5ee3783895d6c73c66270950e84ba1824d935
parentscsi: pm8001: remove set but not used variables 'param, sas_ha' (diff)
downloadlinux-3e14592da654d53d87987aa09753d5a26e45446f.tar.xz
linux-3e14592da654d53d87987aa09753d5a26e45446f.zip
scsi: gdth: Only call dma_free_coherent when buf is not NULL in ioc_general
When building with -Wsometimes-uninitialized, Clang warns: drivers/scsi/gdth.c:3662:6: warning: variable 'paddr' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] Don't attempt to call dma_free_coherent when buf is NULL (meaning that we never called dma_alloc_coherent and initialized paddr), which avoids this warning. Link: https://github.com/ClangBuiltLinux/linux/issues/402 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/gdth.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index e7f1dd4f3b66..0ca9b4393770 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -3697,8 +3697,9 @@ static int ioc_general(void __user *arg, char *cmnd)
rval = 0;
out_free_buf:
- dma_free_coherent(&ha->pdev->dev, gen.data_len + gen.sense_len, buf,
- paddr);
+ if (buf)
+ dma_free_coherent(&ha->pdev->dev, gen.data_len + gen.sense_len,
+ buf, paddr);
return rval;
}