Re: [PATCH 2/3] mmc: davinci: Handle errors from optional IRQ lookup
| Newsgroups | org.infradead.lists.linux-amlogic |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> 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/[email protected]?part=2 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic