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

Adrian Hunter <[email protected]>
Newsgroups org.kernel.vger.linux-tegra,dev.linux.lists.imx,dev.linux.lists.linux-staging,dev.linux.lists.linux-sunxi,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-mediatek,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media,org.kernel.vger.linux-mips,org.kernel.vger.linux-mmc,org.kernel.vger.linux-remoteproc,org.kernel.vger.linux-sound,org.ozlabs.lists.linux-aspeed,org.ozlabs.lists.linuxppc-dev,org.ozlabs.lists.openbmc
Organization Intel Finland Oy, Registered Address: c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo, Business Identity Code: 0357606 - 4, Domiciled in Helsinki
Message-ID <[email protected]>
On 03/07/2026 22:38, Mukesh Ojha 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 <[email protected]>

Acked-by: Adrian Hunter <[email protected]>

> ---
>  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;
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.