Skip to content

Commit 5a02226

Browse files
jhnikulagregkh
authored andcommitted
i3c: mipi-i3c-hci: Error out instead on BUG_ON() in IBI DMA setup
[ Upstream commit 8a2be2f ] 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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 1f48965 commit 5a02226

File tree

1 file changed

+4
-1
lines changed
  • drivers/i3c/master/mipi-i3c-hci

1 file changed

+4
-1
lines changed

drivers/i3c/master/mipi-i3c-hci/dma.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ static int hci_dma_init(struct i3c_hci *hci)
291291

292292
rh->ibi_chunk_sz = dma_get_cache_alignment();
293293
rh->ibi_chunk_sz *= IBI_CHUNK_CACHELINES;
294-
BUG_ON(rh->ibi_chunk_sz > 256);
294+
if (rh->ibi_chunk_sz > 256) {
295+
ret = -EINVAL;
296+
goto err_out;
297+
}
295298

296299
ibi_status_ring_sz = rh->ibi_status_sz * rh->ibi_status_entries;
297300
ibi_data_ring_sz = rh->ibi_chunk_sz * rh->ibi_chunks_total;

0 commit comments

Comments
 (0)