Re: [PATCH 23/42] mmc: sdhci-of-bst: Use devm_of_reserved_mem_device_init_by_idx()

From: Ulf Hansson

Date: Fri Jul 10 2026 - 09:11:54 EST


On Fri, Jul 3, 2026 at 9:48 PM Mukesh Ojha <mukesh.ojha@xxxxxxxxxxxxxxxx> wrote:
>
> Use the devres-managed devm_of_reserved_mem_device_init_by_idx() instead
> of the manual of_reserved_mem_device_init_by_idx()/
> of_reserved_mem_device_release() pair, letting the device resource
> manager handle cleanup automatically.
>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@xxxxxxxxxxxxxxxx>

Acked-by: Ulf Hansson <ulfh@xxxxxxxxxx>

Kind regards
Uffe

> ---
> drivers/mmc/host/sdhci-of-bst.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-bst.c b/drivers/mmc/host/sdhci-of-bst.c
> index f8d3df715e1a..304554ced690 100644
> --- a/drivers/mmc/host/sdhci-of-bst.c
> +++ b/drivers/mmc/host/sdhci-of-bst.c
> @@ -405,7 +405,6 @@ static void sdhci_bst_free_bounce_buffer(struct sdhci_host *host)
> host->bounce_buffer, host->bounce_addr);
> host->bounce_buffer = NULL;
> }
> - of_reserved_mem_device_release(mmc_dev(host->mmc));
> }
>
> static int sdhci_bst_alloc_bounce_buffer(struct sdhci_host *host)
> @@ -417,7 +416,7 @@ static int sdhci_bst_alloc_bounce_buffer(struct sdhci_host *host)
> /* Fixed SRAM bounce size to 32KB: verified config under 32-bit DMA addressing limit */
> bounce_size = SZ_32K;
>
> - ret = of_reserved_mem_device_init_by_idx(mmc_dev(mmc), mmc_dev(mmc)->of_node, 0);
> + ret = devm_of_reserved_mem_device_init_by_idx(mmc_dev(mmc), mmc_dev(mmc)->of_node, 0);
> if (ret) {
> dev_err(mmc_dev(mmc), "Failed to initialize reserved memory\n");
> return ret;
> @@ -425,10 +424,8 @@ static int sdhci_bst_alloc_bounce_buffer(struct sdhci_host *host)
>
> host->bounce_buffer = dma_alloc_coherent(mmc_dev(mmc), bounce_size,
> &host->bounce_addr, GFP_KERNEL);
> - if (!host->bounce_buffer) {
> - of_reserved_mem_device_release(mmc_dev(mmc));
> + if (!host->bounce_buffer)
> return -ENOMEM;
> - }
>
> host->bounce_buffer_size = bounce_size;
>
> --
> 2.53.0
>