Use the devres-managed devm_of_reserved_mem_device_init() instead of
the manual of_reserved_mem_device_init()/of_reserved_mem_device_release()
pair, letting the device resource manager handle cleanup automatically.

Signed-off-by: Mukesh Ojha <[email protected]>
---
 drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c 
b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
index 444fb53878d1..7b5aa94064a1 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
@@ -266,7 +266,7 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
                return ret;
        }
 
-       ret = of_reserved_mem_device_init(dev->dev);
+       ret = devm_of_reserved_mem_device_init(dev->dev);
        if (ret && ret != -ENODEV) {
                dev_err(dev->dev, "Failed to reserve memory\n");
 
@@ -341,8 +341,6 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
 err_sram:
        sunxi_sram_release(dev->dev);
 err_mem:
-       of_reserved_mem_device_release(dev->dev);
-
        return ret;
 }
 
@@ -353,6 +351,4 @@ void cedrus_hw_remove(struct cedrus_dev *dev)
                cedrus_hw_suspend(dev->dev);
 
        sunxi_sram_release(dev->dev);
-
-       of_reserved_mem_device_release(dev->dev);
 }
-- 
2.53.0


Reply via email to