All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Linus Walleij" <linusw@kernel.org>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v3 06/22] dmaengine: ste_dma40: Handle runtime PM resume errors
Date: Fri, 18 Sep 2026 16:37:00 +0000	[thread overview]
Message-ID: <20260918163701.2366F1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260918-dma40-fixes-v3-6-8dd8450669e8@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] dmaengine: ste_dma40: skip channel teardown on PM resume failure
- [High] dmaengine: ste_dma40: leave descriptor queued on PM resume failure
--

commit ed522d6297daebccbf846812d9e9d09ad29b8000
Author: Linus Walleij <linusw@kernel.org>

    dmaengine: ste_dma40: Handle runtime PM resume errors
    
    This commit replaces pm_runtime_get_sync() with pm_runtime_resume_and_get()
    in several ste_dma40 channel operations. It adds error checking to abort
    hardware access if the PM resume fails.

> diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
> index 1baee6f4d919a..c6f633353f3ea 100644
> --- a/drivers/dma/ste_dma40.c
> +++ b/drivers/dma/ste_dma40.c

[ ... ]

> @@ -1521,8 +1527,13 @@ static struct d40_desc *d40_queue_start(struct d40_chan *d40c)
>  
>  	if (d40d != NULL) {
>  		if (!d40c->busy) {
> +			err = pm_runtime_resume_and_get(d40c->base->dev);
> +			if (err < 0) {
> +				chan_err(d40c, "Failed to resume DMA: %d\n",
> +					 err);
> +				return ERR_PTR(err);
> +			}

[Severity: High]
Does returning an error here without removing the pending descriptor from the
queue or scheduling a completion tasklet cause issues? If a caller such as
dma_async_issue_pending() triggers this, it appears the DMA client will hang
indefinitely waiting for a transfer completion callback that never arrives.

>  			d40c->busy = true;
> -			pm_runtime_get_sync(d40c->base->dev);
>  		}
>  
>  		/* Remove from queue */

[ ... ]

> @@ -2042,9 +2053,6 @@ static int d40_free_dma(struct d40_chan *d40c)
>  	struct d40_phy_res *phy = d40c->phy_chan;
>  	bool is_src;
>  
> -	/* Terminate all queued and active transfers */
> -	d40_term_all(d40c);
> -
>  	if (phy == NULL) {
>  		chan_err(d40c, "phy == null\n");
>  		return -EINVAL;
> @@ -2066,7 +2074,13 @@ static int d40_free_dma(struct d40_chan *d40c)
>  		return -EINVAL;
>  	}
>  
> -	pm_runtime_get_sync(d40c->base->dev);
> +	res = pm_runtime_resume_and_get(d40c->base->dev);
> +	if (res < 0)
> +		return res;
> +
> +	/* Terminate all queued and active transfers */
> +	d40_term_all(d40c);
> +

[Severity: High]
Can this early return on PM resume failure cause hardware channels and
descriptor memory to leak? By returning before calling d40_term_all() and
d40_alloc_mask_free(), the physical channel state seems permanently locked to
allocated and descriptors are not released.

>  	res = d40_channel_execute_command(d40c, D40_DMA_STOP);
>  	if (res) {
>  		chan_err(d40c, "stop failed\n");

[ ... ]

> @@ -2658,7 +2675,10 @@ static int d40_terminate_all(struct dma_chan *chan)
>  
>  	spin_lock_irqsave(&d40c->lock, flags);
>  
> -	pm_runtime_get_sync(d40c->base->dev);
> +	ret = pm_runtime_resume_and_get(d40c->base->dev);
> +	if (ret < 0)
> +		goto unlock;
> +

[Severity: High]
Does jumping to the unlock label here skip d40_term_all()? If
pm_runtime_resume_and_get() fails, it looks like pending and active
descriptors are left in the queues and permanently leaked instead of being
cleaned up.

>  	ret = d40_channel_execute_command(d40c, D40_DMA_STOP);
>  	if (ret)
>  		chan_err(d40c, "Failed to stop channel\n");

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260918-dma40-fixes-v3-0-8dd8450669e8@kernel.org?part=6

  reply	other threads:[~2026-09-18 16:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 16:24 [PATCH v3 00/22] dmaengine: ste_dma40: Fix numerous accumulated bugs Linus Walleij
2026-09-18 16:24 ` [PATCH v3 01/22] dmaengine: ste_dma40: Fix physical cyclic capability Linus Walleij
2026-09-18 19:57   ` Frank Li
2026-09-18 16:24 ` [PATCH v3 02/22] dmaengine: ste_dma40: Fix cyclic transfer residue Linus Walleij
2026-09-18 16:44   ` sashiko-bot
2026-09-18 21:41   ` Frank Li
2026-09-18 16:24 ` [PATCH v3 03/22] dmaengine: ste_dma40: Fix failed start cleanup Linus Walleij
2026-09-18 16:24 ` [PATCH v3 04/22] dmaengine: ste_dma40: Fix probe runtime PM disable Linus Walleij
2026-09-18 16:24 ` [PATCH v3 05/22] dmaengine: ste_dma40: Check runtime PM in IRQ Linus Walleij
2026-09-18 16:24 ` [PATCH v3 06/22] dmaengine: ste_dma40: Handle runtime PM resume errors Linus Walleij
2026-09-18 16:37   ` sashiko-bot [this message]
2026-09-18 16:24 ` [PATCH v3 07/22] dmaengine: ste_dma40: Return IRQ_NONE without interrupt status Linus Walleij
2026-09-18 16:24 ` [PATCH v3 08/22] dmaengine: ste_dma40: Init hardware before registration Linus Walleij
2026-09-18 16:24 ` [PATCH v3 09/22] dmaengine: ste_dma40: Fix probe IRQ leak Linus Walleij
2026-09-18 16:24 ` [PATCH v3 10/22] dmaengine: ste_dma40: Fix DMA registration unwind Linus Walleij
2026-09-18 16:24 ` [PATCH v3 11/22] dmaengine: ste_dma40: Fix LCLA allocation order Linus Walleij
2026-09-18 16:24 ` [PATCH v3 12/22] dmaengine: ste_dma40: Fix probe LCLA free Linus Walleij
2026-09-18 16:24 ` [PATCH v3 13/22] dmaengine: ste_dma40: Put the LCPA SRAM node Linus Walleij
2026-09-18 16:24 ` [PATCH v3 14/22] dmaengine: ste_dma40: Fix memcpy channel parsing Linus Walleij
2026-09-18 16:24 ` [PATCH v3 15/22] dmaengine: ste_dma40: Validate disabled channel indexes Linus Walleij
2026-09-18 16:24 ` [PATCH v3 16/22] dmaengine: ste_dma40: Validate DMA specifier length Linus Walleij
2026-09-18 16:24 ` [PATCH v3 17/22] dmaengine: ste_dma40: Reject direction changes after allocation Linus Walleij
2026-09-18 16:24 ` [PATCH v3 18/22] dmaengine: ste_dma40: Fix logical channel bounds check Linus Walleij
2026-09-18 16:24 ` [PATCH v3 19/22] dmaengine: ste_dma40: Fix event group bounds Linus Walleij
2026-09-18 16:24 ` [PATCH v3 20/22] dmaengine: ste_dma40: Search all blocks for fixed logical channels Linus Walleij
2026-09-18 16:24 ` [PATCH v3 21/22] dmaengine: ste_dma40: Validate fixed physical channel indexes Linus Walleij
2026-09-18 16:24 ` [PATCH v3 22/22] dmaengine: ste_dma40: Validate memcpy configuration Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260918163701.2366F1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linusw@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.