From vulab at iscas.ac.cn Tue Dec 2 01:52:52 2025 From: vulab at iscas.ac.cn (Haotian Zhang) Date: Tue, 2 Dec 2025 17:52:52 +0800 Subject: [PATCH] staging: vc04_services: vchiq_bus: Check return value of of_dma_configure() Message-ID: <20251202095253.1640-1-vulab@iscas.ac.cn> vchiq_device_register() ignores the return value of of_dma_configure(), which may return -EPROBE_DEFER when the IOMMU is not ready or other error codes. This allows device registration to proceed with incomplete DMA configuration. Check of_dma_configure() return value and fail device registration on error. Fixes: 027e5703de6b ("staging: vc04_services: vchiq_arm: Add new bus type and device type") Signed-off-by: Haotian Zhang --- .../staging/vc04_services/interface/vchiq_arm/vchiq_bus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c index 41ece91ab88a..8d920a7a3777 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c @@ -80,7 +80,12 @@ vchiq_device_register(struct device *parent, const char *name) device->drv_mgmt = dev_get_drvdata(parent); - of_dma_configure(&device->dev, parent->of_node, true); + ret = of_dma_configure(&device->dev, parent->of_node, true); + if (ret) { + dev_err(parent, "DMA configuration failed for %s: %d\n", name, ret); + kfree(device); + return NULL; + } ret = device_register(&device->dev); if (ret) { -- 2.50.1.windows.1 From dan.carpenter at linaro.org Tue Dec 2 02:18:10 2025 From: dan.carpenter at linaro.org (Dan Carpenter) Date: Tue, 2 Dec 2025 13:18:10 +0300 Subject: [PATCH] staging: vc04_services: vchiq_bus: Check return value of of_dma_configure() In-Reply-To: <20251202095253.1640-1-vulab@iscas.ac.cn> References: <20251202095253.1640-1-vulab@iscas.ac.cn> Message-ID: You're not working against the latest tree so this doesn't apply. On Tue, Dec 02, 2025 at 05:52:52PM +0800, Haotian Zhang wrote: > vchiq_device_register() ignores the return value of of_dma_configure(), > which may return -EPROBE_DEFER when the IOMMU is not ready or other error > codes. This allows device registration to proceed with incomplete DMA > configuration. > If of_dma_configure() returns -EPROBE_DEFER then this will just fail and that's not really any better than the existing behavior... regards, dan carpenter > Check of_dma_configure() return value and fail device registration > on error. > > Fixes: 027e5703de6b ("staging: vc04_services: vchiq_arm: Add new bus type and device type") > Signed-off-by: Haotian Zhang