lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f020e55c-d4e4-dbb9-d658-7bef2b8bd94b@starfivetech.com>
Date:   Fri, 14 Apr 2023 09:37:29 +0800
From:   Xingyu Wu <xingyu.wu@...rfivetech.com>
To:     Stephen Boyd <sboyd@...nel.org>, 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>,
        <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

On 2023/4/14 2:38, Stephen Boyd wrote:
> 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.

Get it. Thanks.

Best regards,
Xingyu Wu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ