-------- Пересылаемое сообщение -------- <br />17.09.2024, 23:13, "Mikhail Arkhipov" <m.arhipov@rosa.ru>:<br /><p>If of_dma_controller_register() fails within the edma_probe function,<br />the driver does not check the return value or log the failure. This<br />oversight can cause other drivers that rely on this DMA controller to fail<br />during their probe phase. Specifically, when other drivers call<br />of_dma_request_slave_channel(), they may receive an error code<br />-EPROBE_DEFER, causing their initialization to be delayed or fail without<br />clear logging of the root cause.<br /><br />Add a check for the return value of of_dma_controller_register() in the<br />edma_probe function. If the function returns an error, log an appropriate<br />error message and handle the failure by cleaning up resources and returning<br />the error code. This ensures that the failure is properly reported, which<br />aids in debugging and maintains system stability.<br /><br />Found by Linux Verification Center (linuxtesting.org) with SVACE.<br /><br />Signed-off-by: Mikhail Arkhipov <<a href="mailto:m.arhipov@rosa.ru">m.arhipov@rosa.ru</a>><br />---<br /> drivers/dma/ti/edma.c | 6 +++++-<br /> 1 file changed, 5 insertions(+), 1 deletion(-)<br /><br />diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c<br />index 5f8d2e93ff3f..03b527a04c<span class="1f1ea193f6735cf0wmi-callto">11 100644</span><br />--- a/drivers/dma/ti/edma.c<br />+++ b/drivers/dma/ti/edma.c<br />@@ -2535,7 +2535,11 @@ static int edma_probe(struct platform_device *pdev)<br />         }<br /> <br />         if (node)<br />-          of_dma_controller_register(node, of_edma_xlate, ecc);<br />+              ret = of_dma_controller_register(node, of_edma_xlate, ecc);<br />+                if (ret) {<!-- --><br />+                   dev_err(dev, "Failed to register DMA controller (%d)\n", ret);<br />+                   goto err_reg1;<br />+             }<br /> <br />         dev_info(dev, "TI EDMA DMA engine driver\n");<br /> <br /></p><span class="f55bbb4eeef208e8wmi-sign">-- <br />2.39.3 (Apple Git-146)<br /><br /></span><br />-------- Завершение пересылаемого сообщения --------