Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Paul Burton and committed by
Paul Burton
d4da0e97 5bdd5fbb

+4 -2
+4 -2
arch/mips/mm/c-r4k.c
··· 835 835 static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size) 836 836 { 837 837 /* Catch bad driver code */ 838 - BUG_ON(size == 0); 838 + if (WARN_ON(size == 0)) 839 + return; 839 840 840 841 preempt_disable(); 841 842 if (cpu_has_inclusive_pcaches) { ··· 872 871 static void r4k_dma_cache_inv(unsigned long addr, unsigned long size) 873 872 { 874 873 /* Catch bad driver code */ 875 - BUG_ON(size == 0); 874 + if (WARN_ON(size == 0)) 875 + return; 876 876 877 877 preempt_disable(); 878 878 if (cpu_has_inclusive_pcaches) {