Skip to contentSkip to conversation

dma-mapping: consolidate dma_{alloc,free}_{attrs,coherent}

DISCUSSION Dan Carpenter 1 participant 1 message Sep 12, 2015 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Christoph Hellwig,

This is a semi-automatic email about new static checker warnings.

The patch 60ff3365096f: "dma-mapping: consolidate dma_{alloc,free}_{attrs,coherent}" from Aug 25, 2015, leads to the following Smatch complaint:

arch/x86/kernel/pci-dma.c:137 arch_dma_alloc_attrs()
warn: variable dereferenced before check '*dev' (see line 134)

arch/x86/kernel/pci-dma.c
133 {

   134		*gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp);
                                                    ^^^^

Dereferenced inside function call.

135 *gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
136
137 if (!*dev)

                    ^^^^^

Too late.

   138			*dev = &x86_dma_fallback_dev;
   139		if (!is_device_dma_capable(*dev))

regards,
dan carpenter