lkml.org 
[lkml]   [2020]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 03/14] media: sun6i-csi: Support an optional dedicated memory pool
    On Fri, Oct 23, 2020 at 07:45:35PM +0200, Paul Kocialkowski wrote:
    > This allows selecting a dedicated CMA memory pool (specified via
    > device-tree) instead of the default one.
    >
    > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

    Why would that be needed?

    > ---
    > drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 8 ++++++++
    > 1 file changed, 8 insertions(+)
    >
    > diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
    > index 28e89340fed9..5d2389a5cd17 100644
    > --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
    > +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
    > @@ -16,6 +16,7 @@
    > #include <linux/module.h>
    > #include <linux/of.h>
    > #include <linux/of_device.h>
    > +#include <linux/of_reserved_mem.h>
    > #include <linux/platform_device.h>
    > #include <linux/pm_runtime.h>
    > #include <linux/regmap.h>
    > @@ -849,6 +850,12 @@ static int sun6i_csi_resource_request(struct sun6i_csi_dev *sdev,
    > return PTR_ERR(sdev->regmap);
    > }
    >
    > + ret = of_reserved_mem_device_init(&pdev->dev);
    > + if (ret && ret != -ENODEV) {
    > + dev_err(&pdev->dev, "Unable to init reserved memory\n");
    > + return ret;
    > + }
    > +
    > sdev->clk_mod = devm_clk_get(&pdev->dev, "mod");

    If that clk_get or any subsequent function fail you'll end up leaking
    whatever the initialization of the reserved memory has allocated

    Maxime
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2020-10-26 16:41    [W:4.114 / U:0.320 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site