xtensa: fix address checks in dma_{alloc,free}_coherent
authorAlan Douglas <adouglas@cadence.com>
Wed, 23 Jul 2014 10:06:40 +0000 (14:06 +0400)
committerZefan Li <lizefan@huawei.com>
Thu, 25 Sep 2014 03:49:12 +0000 (11:49 +0800)
commitfb2ae73e3a0ae4abdae30bfc086e52944713520b
treef1b719e9446da8429f1c5667d149d0ede91b0067
parent2297927578135dd7abf9306b08628c12ae8eeaa0
xtensa: fix address checks in dma_{alloc,free}_coherent

commit 1ca49463c44c970b1ab1d71b0f268bfdf8427a7e upstream.

Virtual address is translated to the XCHAL_KSEG_CACHED region in the
dma_free_coherent, but is checked to be in the 0...XCHAL_KSEG_SIZE
range.

Change check for end of the range from 'addr >= X' to 'addr > X - 1' to
handle the case of X == 0.

Replace 'if (C) BUG();' construct with 'BUG_ON(C);'.

Signed-off-by: Alan Douglas <adouglas@cadence.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
arch/xtensa/kernel/pci-dma.c