Commit 3e14592d authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Martin K. Petersen

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/402Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a4b207de
...@@ -3697,8 +3697,9 @@ static int ioc_general(void __user *arg, char *cmnd) ...@@ -3697,8 +3697,9 @@ static int ioc_general(void __user *arg, char *cmnd)
rval = 0; rval = 0;
out_free_buf: out_free_buf:
dma_free_coherent(&ha->pdev->dev, gen.data_len + gen.sense_len, buf, if (buf)
paddr); dma_free_coherent(&ha->pdev->dev, gen.data_len + gen.sense_len,
buf, paddr);
return rval; return rval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment