On Fri, Apr 6, 2018 at 7:44 PM, Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> wrote: > > - if (output->dma) > + if (has_dma) > spin_lock_irq(&output->dma->lock); > > ddbwritel(dev, 0, TS_CONTROL(output)); > > - if (output->dma) { > + if (has_dma) { > ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma)); > output->dma->running = 0; > spin_unlock_irq(&output->dma->lock); > > Even in this case, where has_dma is const, sparse still generates the > warning. Just in case, I also tried changing has_dma to just > "bool" and just "int". Sparse will always warn for this, for the simple reason that the basic block there in the middle that does that ddbwritel(dev, 0, TS_CONTROL(output)); has two different locking contexts. So the only way to get sparse to not warn is to have something like if (output->dma) { spin_lock_irq(&output->dma->lock); ddbwritel(dev, 0, TS_CONTROL(output)); ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma)); output->dma->running = 0; spin_unlock_irq(&output->dma->lock); } else { ddbwritel(dev, 0, TS_CONTROL(output)); } which probably generates better code too when that "shared" region is smaller than the rest of the code. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html