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

i3c: mipi-i3c-hci: Error out instead on BUG_ON() in IBI DMA setup

Definitely condition dma_get_cache_alignment * defined value > 256
during driver initialization is not reason to BUG_ON(). Turn that to
graceful error out with -EINVAL.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20240628131559.502822-3-jarkko.nikula@linux.intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Jarkko Nikula and committed by
Alexandre Belloni
8a2be2f1 2df1de81

+4 -1
+4 -1
drivers/i3c/master/mipi-i3c-hci/dma.c
··· 279 279 280 280 rh->ibi_chunk_sz = dma_get_cache_alignment(); 281 281 rh->ibi_chunk_sz *= IBI_CHUNK_CACHELINES; 282 - BUG_ON(rh->ibi_chunk_sz > 256); 282 + if (rh->ibi_chunk_sz > 256) { 283 + ret = -EINVAL; 284 + goto err_out; 285 + } 283 286 284 287 ibi_status_ring_sz = rh->ibi_status_sz * rh->ibi_status_entries; 285 288 ibi_data_ring_sz = rh->ibi_chunk_sz * rh->ibi_chunks_total;