All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: neil.armstrong@linaro.org, linux-amlogic@lists.infradead.org
Subject: Re: [PATCH 2/3] mmc: davinci: Handle errors from optional IRQ lookup
Date: Wed, 12 Aug 2026 11:47:11 +0000	[thread overview]
Message-ID: <20260812114711.8641E1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260812112023.42254-3-phucduc.bui@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Direct return on error from `platform_get_irq_optional()` leaks the clock prepare/enable reference.
--

--- Patch [2]: [PATCH 2/3] mmc: davinci: Handle errors from optional IRQ lookup ---
commit 3b3d706a95688ff2d8229702c82d2a0cd95e3f5d
Author: bui duc phuc <phucduc.bui@gmail.com>

mmc: davinci: Handle errors from optional IRQ lookup

This commit updates the error handling for platform_get_irq_optional to
propagate negative error codes, such as -EPROBE_DEFER, rather than storing
them directly as the sdio_irq number. This allows the caller to handle these
errors appropriately instead of blindly continuing the probe.

> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index cdb9fa94b56d0..4765d2dee5993 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -1248,7 +1248,11 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
>  
>  	host->use_dma = use_dma;
>  	host->mmc_irq = irq;
> -	host->sdio_irq = platform_get_irq_optional(pdev, 1);
> +	ret = platform_get_irq_optional(pdev, 1);
> +	if (ret < 0 && ret != -ENXIO)
> +		return ret;

[Severity: High]
Does this direct return leak the clock reference?

Earlier in davinci_mmcsd_probe(), the clock is prepared and enabled:

	ret = clk_prepare_enable(host->clk);
	if (ret)
		return ret;

If platform_get_irq_optional() returns an error like -EPROBE_DEFER, returning
directly here bypasses the cleanup labels at the end of the function that
call clk_disable_unprepare(host->clk). This can endlessly increase the
clock reference count on probe retries, permanently preventing the clock from
being disabled for power management.

Should this use a goto label (like parse_fail or dma_probe_defer) instead?

> +	if (ret > 0)
> +		host->sdio_irq = ret;
>  
>  	if (host->use_dma) {
>  		ret = davinci_acquire_dma_channels(host);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812112023.42254-1-phucduc.bui@gmail.com?part=2

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-08-12 11:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 11:20 [PATCH 0/3] mmc: Handle errors from optional IRQ lookup phucduc.bui
2026-08-12 11:20 ` phucduc.bui
2026-08-12 11:20 ` [PATCH 1/3] mmc: meson-gx: " phucduc.bui
2026-08-12 11:20   ` phucduc.bui
2026-08-12 11:40   ` sashiko-bot
2026-08-12 11:20 ` [PATCH 2/3] mmc: davinci: " phucduc.bui
2026-08-12 11:20   ` phucduc.bui
2026-08-12 11:47   ` sashiko-bot [this message]
2026-08-12 11:20 ` [PATCH 3/3] mmc: davinci: Handle optional IRQ return value correctly phucduc.bui
2026-08-12 11:20   ` phucduc.bui
2026-08-12 11:56   ` sashiko-bot

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=20260812114711.8641E1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=phucduc.bui@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.