MIPS: WARN_ON invalid DMA cache maintenance, not BUG_ON

If a driver causes DMA cache maintenance with a zero length then we
currently BUG and kill the kernel. As this is a scenario that we may
well be able to recover from, WARN & return in the condition instead.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/14623/
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
This commit is contained in:
Paul Burton 2016-11-25 18:46:09 +00:00 committed by Paul Burton
parent 5bdd5fbb35
commit d4da0e97ba
No known key found for this signature in database
GPG Key ID: 3EA79FACB57500DD

View File

@ -835,7 +835,8 @@ static void r4k_flush_icache_user_range(unsigned long start, unsigned long end)
static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size) static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
{ {
/* Catch bad driver code */ /* Catch bad driver code */
BUG_ON(size == 0); if (WARN_ON(size == 0))
return;
preempt_disable(); preempt_disable();
if (cpu_has_inclusive_pcaches) { if (cpu_has_inclusive_pcaches) {
@ -871,7 +872,8 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
static void r4k_dma_cache_inv(unsigned long addr, unsigned long size) static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
{ {
/* Catch bad driver code */ /* Catch bad driver code */
BUG_ON(size == 0); if (WARN_ON(size == 0))
return;
preempt_disable(); preempt_disable();
if (cpu_has_inclusive_pcaches) { if (cpu_has_inclusive_pcaches) {