linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: vc04_services: vchiq_bus: Check return value of of_dma_configure()
@ 2025-12-02  9:52 Haotian Zhang
  2025-12-02 10:18 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Haotian Zhang @ 2025-12-02  9:52 UTC (permalink / raw)
  To: Florian Fainelli, Broadcom internal kernel review list,
	Greg Kroah-Hartman
  Cc: linux-rpi-kernel, linux-arm-kernel, linux-staging, linux-kernel,
	Haotian Zhang

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 <vulab@iscas.ac.cn>
---
 .../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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-02 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02  9:52 [PATCH] staging: vc04_services: vchiq_bus: Check return value of of_dma_configure() Haotian Zhang
2025-12-02 10:18 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).