Skip to content

Commit 085c36e

Browse files
committed
dmaengine: sdxi: context: Handle failed completion allocations
Check for failed sdxi_completion_alloc() and return early in sdxi_start_cxt, sdxi_stop_cxt. Signed-off-by: Nathan Lynch <nathan.lynch@amd.com>
1 parent 1e7def8 commit 085c36e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/dma/sdxi/context.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ int sdxi_start_cxt(struct sdxi_cxt *cxt)
406406
struct sdxi_completion *sc __free(sdxi_completion) =
407407
sdxi_completion_alloc(cxt->sdxi);
408408

409+
if (!sc)
410+
return -ENOMEM;
411+
409412
/* This is not how to start the admin context. */
410413
if (WARN_ON(adm == cxt))
411414
return -EINVAL;
@@ -438,6 +441,9 @@ void sdxi_stop_cxt(struct sdxi_cxt *cxt)
438441
struct sdxi_completion *sc __free(sdxi_completion) =
439442
sdxi_completion_alloc(cxt->sdxi);
440443

444+
if (!sc)
445+
return;
446+
441447
/* This is not how to stop the admin context. */
442448
if (WARN_ON(adm == cxt))
443449
return;

0 commit comments

Comments
 (0)