On Thu Sep 3 01:37:00 2026 +0530, Mukesh Ojha wrote:
> Switch to devm_of_reserved_mem_device_init() so the reserved memory
> region is released automatically on probe failure or device removal.
> Remove the four explicit of_reserved_mem_device_release() calls and
> collapse the now-empty err_release_mem label into err_free.
> 
> Signed-off-by: Mukesh Ojha <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/platform/nuvoton/npcm-video.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

---

diff --git a/drivers/media/platform/nuvoton/npcm-video.c 
b/drivers/media/platform/nuvoton/npcm-video.c
index c28d9d7edd83..a6737c65d9b2 100644
--- a/drivers/media/platform/nuvoton/npcm-video.c
+++ b/drivers/media/platform/nuvoton/npcm-video.c
@@ -1719,17 +1719,15 @@ static int npcm_video_init(struct npcm_video *video)
                return rc;
        }
 
-       of_reserved_mem_device_init(dev);
+       devm_of_reserved_mem_device_init(dev);
        rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
        if (rc) {
                dev_err(dev, "Failed to set DMA mask\n");
-               of_reserved_mem_device_release(dev);
                return rc;
        }
 
        rc = npcm_video_ece_init(video);
        if (rc) {
-               of_reserved_mem_device_release(dev);
                dev_err(dev, "Failed to initialize ECE\n");
                return rc;
        }
@@ -1793,13 +1791,11 @@ static int npcm_video_probe(struct platform_device 
*pdev)
 
        rc = npcm_video_setup_video(video);
        if (rc)
-               goto err_release_mem;
+               goto err_free;
 
        dev_info(video->dev, "NPCM video driver probed\n");
        return 0;
 
-err_release_mem:
-       of_reserved_mem_device_release(&pdev->dev);
 err_free:
        kfree(video);
        return rc;
@@ -1817,7 +1813,6 @@ static void npcm_video_remove(struct platform_device 
*pdev)
        if (video->ece.enable)
                npcm_video_ece_stop(video);
        kfree(video);
-       of_reserved_mem_device_release(dev);
 }
 
 static const struct of_device_id npcm_video_match[] = {
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to