]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390: pci: don't print uninitialized data for debugging
authorArnd Bergmann <arnd@arndb.de>
Thu, 10 Nov 2016 16:44:48 +0000 (17:44 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 11 Nov 2016 16:45:08 +0000 (08:45 -0800)
gcc correctly warns about an incorrect use of the 'pa' variable in case
we pass an empty scatterlist to __s390_dma_map_sg:

  arch/s390/pci/pci_dma.c: In function '__s390_dma_map_sg':
  arch/s390/pci/pci_dma.c:309:13: warning: 'pa' may be used uninitialized in this function [-Wmaybe-uninitialized]

This adds a bogus initialization to the function to sanitize the debug
output.  I would have preferred a solution without the initialization,
but I only got the report from the kbuild bot after turning on the
warning again, and didn't manage to reproduce it myself.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/s390/pci/pci_dma.c

index 7350c8bc13a290ca362ad25b69cdb050c72ab3f4..6b2f72f523b91bb6c68347602b33ca2446807229 100644 (file)
@@ -423,7 +423,7 @@ static int __s390_dma_map_sg(struct device *dev, struct scatterlist *sg,
        dma_addr_t dma_addr_base, dma_addr;
        int flags = ZPCI_PTE_VALID;
        struct scatterlist *s;
-       unsigned long pa;
+       unsigned long pa = 0;
        int ret;
 
        size = PAGE_ALIGN(size);