]> git.baikalelectronics.ru Git - kernel.git/commit
dma-coherent: fix dma_declare_coherent_memory() logic error
authorArnd Bergmann <arnd@arndb.de>
Tue, 5 Sep 2017 08:10:09 +0000 (10:10 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 5 Sep 2017 11:23:11 +0000 (13:23 +0200)
commit0f88b69d34f806e072b5f544e4b5ac00d0e84ceb
tree1938ce180b8428314beb93fbcdfc2a7f29f5f796
parent0492a2942d47ff39b055fd4dc0b5d8db21c8a437
dma-coherent: fix dma_declare_coherent_memory() logic error

A recent change interprets the return code of dma_init_coherent_memory
as an error value, but it is instead a boolean, where 'true' indicates
success. This leads causes the caller to always do the wrong thing,
and also triggers a compile-time warning about it:

drivers/base/dma-coherent.c: In function 'dma_declare_coherent_memory':
drivers/base/dma-coherent.c:99:15: error: 'mem' may be used uninitialized in this function [-Werror=maybe-uninitialized]

I ended up changing the code a little more, to give use the usual
error handling, as this seemed the best way to fix up the warning
and make the code look reasonable at the same time.

Fixes: bd3b78183d61 ("dma-coherent: remove the DMA_MEMORY_MAP and DMA_MEMORY_IO flags")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/base/dma-coherent.c