From 9873b171697033f9f19608d98bcd1c16cacb92af Mon Sep 17 00:00:00 2001 From: Mark Millard Date: Fri, 17 Feb 2023 16:30:35 -0400 Subject: [PATCH] bcm_dma: attach at an earlier bus pass The sdhci_bcm driver attach routine relies on bcm_dma already being attached, in order to allocate a DMA channel. However, both drivers attached at the default pass so this is not guaranteed. Newer RPI firmware exposes this assumption, and the result is a NULL-dereference in bcm_dma_allocate(). To fix this, use BUS_PASS_SUPPORTDEV for bcm_dma. PR: 268835 Reviewed by: mhorne MFC after: 1 week --- sys/arm/broadcom/bcm2835/bcm2835_dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_dma.c b/sys/arm/broadcom/bcm2835/bcm2835_dma.c index 5f9ecb0b7981..49a3938282a2 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_dma.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_dma.c @@ -764,5 +764,6 @@ static driver_t bcm_dma_driver = { sizeof(struct bcm_dma_softc), }; -DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, 0, 0); +EARLY_DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, 0, 0, + BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(bcm_dma, 1);