[PATCH] dmaengine: fix incorrect return value for dma_request_chan()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dma_request_chan() is expected to return ERR_PTR rather than NULL. This
triggered a crash in pl011_dma_probe() when dma_device_list is empty
and returning NULL. Fix return of NULL ptr to ERR_PTR(-ENODEV).

Fixes: deb9541f5052 ("dmaengine: check device and channel list for empty")
Reported-by: Arnd Bergmann <arnd@xxxxxxxx>
Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>
---
 drivers/dma/dmaengine.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 0d6529eff66f..48e159e83cf5 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -852,7 +852,7 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
 	mutex_lock(&dma_list_mutex);
 	if (list_empty(&dma_device_list)) {
 		mutex_unlock(&dma_list_mutex);
-		return NULL;
+		return ERR_PTR(-ENODEV);
 	}
 
 	list_for_each_entry_safe(d, _d, &dma_device_list, global_node) {




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux