dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: fix incorrect return value for dma_request_chan()
@ 2020-07-06 15:18 Dave Jiang
  2020-07-06 15:59 ` Arnd Bergmann
  2020-07-07  5:01 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Dave Jiang @ 2020-07-06 15:18 UTC (permalink / raw)
  To: vkoul; +Cc: Arnd Bergmann, dmaengine

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@arndb.de>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 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) {


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

* Re: [PATCH] dmaengine: fix incorrect return value for dma_request_chan()
  2020-07-06 15:18 [PATCH] dmaengine: fix incorrect return value for dma_request_chan() Dave Jiang
@ 2020-07-06 15:59 ` Arnd Bergmann
  2020-07-07  5:01 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2020-07-06 15:59 UTC (permalink / raw)
  To: Dave Jiang; +Cc: Vinod Koul, dmaengine

On Mon, Jul 6, 2020 at 5:18 PM Dave Jiang <dave.jiang@intel.com> wrote:
>
> 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@arndb.de>

It was really
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Though I did the analysis and found what caused the problem.

The fix looks good,

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH] dmaengine: fix incorrect return value for dma_request_chan()
  2020-07-06 15:18 [PATCH] dmaengine: fix incorrect return value for dma_request_chan() Dave Jiang
  2020-07-06 15:59 ` Arnd Bergmann
@ 2020-07-07  5:01 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2020-07-07  5:01 UTC (permalink / raw)
  To: Dave Jiang; +Cc: Arnd Bergmann, dmaengine

On 06-07-20, 08:18, Dave Jiang wrote:
> 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@arndb.de>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Applied after updating the correct reported to Naresh

thanks
-- 
~Vinod

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

end of thread, other threads:[~2020-07-07  5:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06 15:18 [PATCH] dmaengine: fix incorrect return value for dma_request_chan() Dave Jiang
2020-07-06 15:59 ` Arnd Bergmann
2020-07-07  5:01 ` Vinod Koul

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).