[PATCH 18/34] mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()

Andrew Jeffery andrew at codeconstruct.com.au
Thu May 29 10:46:02 AEST 2025


On Wed, 2025-05-28 at 12:42 +0800, Binbin Zhou wrote:
> Hi Andrew:
> 
> Thanks for your reply.
> 
> On Wed, May 28, 2025 at 8:44 AM Andrew Jeffery
> <andrew at codeconstruct.com.au> wrote:
> > 
> > On Mon, 2025-05-26 at 14:06 +0800, Binbin Zhou wrote:
> > > Since the devm_mmc_alloc_host() helper is already in
> > > use,
> > 
> > This doesn't appear to be true? aspeed_sdhci_probe() calls
> > sdhci_pltfm_init(), and following that through eventually we call
> > mmc_alloc_host() (the non-devm_ variant).
> > 
> > That said, there are some error paths in aspeed_sdhci_probe() where we
> > leak the object. Improving the code would be helpful, but my
> > understanding is this patch isn't right.
> 
> Sorry, I have a different thought.
> In the original code, there does seem to be a leakage of objects, for example:
> 
> pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
>         if (IS_ERR(pltfm_host->clk))
>                 return PTR_ERR(pltfm_host->clk);
> 
> With this error path, we should goto err_pltfm_free;
> 
> Now, I have replaced mmc_alloc_host() with devm_mmc_alloc_host() in
> Patch-1[1], so I don't think there will be any error path leakage of
> objects.
> 
> [1]: https://lore.kernel.org/all/6fd5afb003982bb5edbf95f76b605686223730e0.1747792905.git.zhoubinbin@loongson.cn/

Okay, I didn't track down the rest of the series on lore. I don't
personally mind if you send me the whole series, that would certainly
have helped with the context in this case.

Andrew


More information about the Linux-aspeed mailing list