Skip to content

Commit 8a2be2f

Browse files
jhnikulaalexandrebelloni
authored andcommitted
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>
1 parent 2df1de8 commit 8a2be2f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • drivers/i3c/master/mipi-i3c-hci

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

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

280280
rh->ibi_chunk_sz = dma_get_cache_alignment();
281281
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+
}
283286

284287
ibi_status_ring_sz = rh->ibi_status_sz * rh->ibi_status_entries;
285288
ibi_data_ring_sz = rh->ibi_chunk_sz * rh->ibi_chunks_total;

0 commit comments

Comments
 (0)