From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BD93C77B61 for ; Thu, 13 Apr 2023 18:38:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229546AbjDMSiv (ORCPT ); Thu, 13 Apr 2023 14:38:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbjDMSiu (ORCPT ); Thu, 13 Apr 2023 14:38:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE02940E7; Thu, 13 Apr 2023 11:38:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 46B26640CF; Thu, 13 Apr 2023 18:38:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BBE7C433EF; Thu, 13 Apr 2023 18:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681411128; bh=dzjuCgvj32gFNE1zyb8VjhG7HjDoQx2QthY/c2I2Lpg=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=iwJvM8gYpu2NK3VPMKGHwKdDmGZiFn5eJ3XrHZUH00mPtJ5Cum9Rb/YsWI2GCjjxh +037VF3OBpkjeEqhoutZ7cvsZSPH1tAVQsOwLf2FkUcI/MoD2BU/BJMdrnn1Egx245 aWZ1RLbknn9BvgxDVUI5cC7yn+oz8f59i6+/9588tFGnaZpiD7lg8o+KDhPmZs4cB2 uNj/Mww9nsbepDK6X1rV81xlz+yiBTr4Uso9tGeaAxNTbypavIAArg5Z4VpQqeEUj6 td2BEgRsAuRxsqzGoNJY9gBCntBELonP42VwdDhR0gVC5wOxkPRwreWM/gkpU/IP24 tw52FMK+b25Mw== Message-ID: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <4ed4d0e6-8da5-7eef-8713-44854b8d4a9b@starfivetech.com> References: <20230411135558.44282-1-xingyu.wu@starfivetech.com> <20230411135558.44282-8-xingyu.wu@starfivetech.com> <683cbe934d1df9436e003466d2a419ef.sboyd@kernel.org> <463ee23c-f617-bed0-27a8-56c6fb40d092@starfivetech.com> <4ed4d0e6-8da5-7eef-8713-44854b8d4a9b@starfivetech.com> Subject: Re: [PATCH v4 07/10] clk: starfive: Add StarFive JH7110 Video-Output clock driver From: Stephen Boyd Cc: Rob Herring , Paul Walmsley , Palmer Dabbelt , Albert Ou , Hal Feng , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org To: Conor Dooley , Emil Renner Berthing , Krzysztof Kozlowski , Michael Turquette , Philipp Zabel , Xingyu Wu , devicetree@vger.kernel.org, linux-riscv@lists.infradead.org Date: Thu, 13 Apr 2023 11:38:45 -0700 User-Agent: alot/0.10 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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/c= lk/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 > > #include > > #include > > +#include > > + > > +#include > > =20 > > #include > > =20 > > @@ -335,26 +338,32 @@ static void jh7110_reset_unregister_adev(void *_a= dev) > > struct auxiliary_device *adev =3D _adev; > > =20 > > auxiliary_device_delete(adev); > > + auxiliary_device_uninit(adev); > > } > > =20 > > static void jh7110_reset_adev_release(struct device *dev) > > { > > struct auxiliary_device *adev =3D to_auxiliary_dev(dev); > > + struct jh71x0_reset_adev *rdev =3D to_jh71x0_reset_adev(adev); > > =20 > > - auxiliary_device_uninit(adev); > > + kfree(rdev); > > } > > =20 > > 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; > > =20 > > - adev =3D devm_kzalloc(priv->dev, sizeof(*adev), GFP_KERNEL); > > - if (!adev) > > + rdev =3D kzalloc(sizeof(*rdev), GFP_KERNEL); >=20 > Can there use 'devm_kzalloc'? Are you not using this because the struct i= s 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.