Thread (63 messages) 63 messages, 13 authors, 1d ago

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

From: Ulf Hansson <hidden>
Date: 2026-07-10 13:08:51
Also in: dri-devel, imx, linux-arm-msm, linux-devicetree, linux-media, linux-mediatek, linux-mips, linux-mmc, linux-remoteproc, linux-sound, linux-staging, linux-sunxi, linux-tegra, lkml

On Fri, Jul 3, 2026 at 9:48 PM Mukesh Ojha [off-list ref] 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 <redacted>
Acked-by: Ulf Hansson <ulfh@kernel.org>

Kind regards
Uffe
quoted hunk ↗ jump to hunk
---
 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
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help