[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d70886f6ee13e70845a72354fe9a2b7d.sboyd@kernel.org>
Date: Thu, 13 Apr 2023 11:38:45 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Conor Dooley <conor@...nel.org>,
Emil Renner Berthing <kernel@...il.dk>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Michael Turquette <mturquette@...libre.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Xingyu Wu <xingyu.wu@...rfivetech.com>,
devicetree@...r.kernel.org, linux-riscv@...ts.infradead.org
Cc: Rob Herring <robh+dt@...nel.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Hal Feng <hal.feng@...rfivetech.com>,
linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org
Subject: Re: [PATCH v4 07/10] clk: starfive: Add StarFive JH7110 Video-Output clock driver
Quoting Xingyu Wu (2023-04-13 06:31:12)
> On 2023/4/13 12:04, Stephen Boyd wrote:
> > diff --git a/drivers/clk/starfive/clk-starfive-jh7110-sys.c b/drivers/clk/starfive/clk-starfive-jh7110-sys.c
> > index 5ec210644e1d..851b93d0f371 100644
> > --- a/drivers/clk/starfive/clk-starfive-jh7110-sys.c
> > +++ b/drivers/clk/starfive/clk-starfive-jh7110-sys.c
> > @@ -11,6 +11,9 @@
> > #include <linux/init.h>
> > #include <linux/io.h>
> > #include <linux/platform_device.h>
> > +#include <linux/slab.h>
> > +
> > +#include <soc/starfive/reset-starfive-jh71x0.h>
> >
> > #include <dt-bindings/clock/starfive,jh7110-crg.h>
> >
> > @@ -335,26 +338,32 @@ static void jh7110_reset_unregister_adev(void *_adev)
> > struct auxiliary_device *adev = _adev;
> >
> > auxiliary_device_delete(adev);
> > + auxiliary_device_uninit(adev);
> > }
> >
> > static void jh7110_reset_adev_release(struct device *dev)
> > {
> > struct auxiliary_device *adev = to_auxiliary_dev(dev);
> > + struct jh71x0_reset_adev *rdev = to_jh71x0_reset_adev(adev);
> >
> > - auxiliary_device_uninit(adev);
> > + kfree(rdev);
> > }
> >
> > int jh7110_reset_controller_register(struct jh71x0_clk_priv *priv,
> > const char *adev_name,
> > u32 adev_id)
> > {
> > + struct jh71x0_reset_adev *rdev;
> > struct auxiliary_device *adev;
> > int ret;
> >
> > - adev = devm_kzalloc(priv->dev, sizeof(*adev), GFP_KERNEL);
> > - if (!adev)
> > + rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
>
> Can there use 'devm_kzalloc'? Are you not using this because the struct is public and clock driver
> and reset driver both use it. But I think the both clock driver and reset driver are the same
> device and can use 'devm_kzalloc'.
No. The release function for the auxiliary_device is supposed to free
the memory. It shouldn't be tied to the lifetime of anything like the
lifetime of the clk driver being bound.
Powered by blists - more mailing lists