Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2848918rwl; Thu, 13 Apr 2023 11:41:42 -0700 (PDT) X-Google-Smtp-Source: AKy350bgqacg6oByszHmHKGvXZC/ge4hNyvQlqwPxLYKH/PS2ZtaOYBgY78z36GtwVmOuOoVjp4g X-Received: by 2002:a05:6a20:2008:b0:eb:83f1:80a6 with SMTP id w8-20020a056a20200800b000eb83f180a6mr2732483pzw.47.1681411301831; Thu, 13 Apr 2023 11:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681411301; cv=none; d=google.com; s=arc-20160816; b=JyZ6uERaCen1d53ffsQuHGwJ473vdH1yWiy5LxSaslIygqxdEokc3OjNTtel6GE8ew lXQosh/RyaiQjhar70bQZM9uSRVewY6BB+jfHw4MCG/08TLJ9xJhI1TlH0b1iN69n6RP VsQPPmv298JsxVH7DgL4BwS2PMWWYwfPmkltNDC2wa2ITwo/bP15psAQ6f0ULU6oOxbi GDU2sQiUCOuyMiQmEl/4qilq2uejtgI+CYHdx9jAUEjmDG3DocIRmEvdUIqofQXN5Kvn 75rKgHk5mflp2pGcpgdGx8opIZl3mkmSD7my2urgu1CQNZVBq6Y2cLPamwYwfzlNdGo2 O7lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:message-id :dkim-signature; bh=5cOpWVyo/HmJKeyHkfMJJx7C7ZtfoRFA802oS4iy1o4=; b=jUcTLSIehMTwVt6qahrs0KTrN0xivToFVnOamFN3Fywe3leiQX2byKJP6RKafvHfvF DdDRIpyKdClP2ksNSyUQzANvfokIZhdca3TPdjLDVVwWEG2Gxsmn006eYq4IUCu85MJK kbAIcH2lqi2swUwIV/MBUB4pZTXivfF3NsxmV72S+0zlIPFvkzbJZD6XwHZwxKkzkPLC +W6TW7gwoJC4t57LZH3ubUMO7H6mkPGCZtpT13KSa5VPNxt+TYxKbfiiFQzRqjHw5TIu YcUr+40m1d1T1bnmw6Nyoy9u33eT5Uwc4z4ZgXJxAtChTWH+gPpw0qrLJGuE4GvcQIW8 oPIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iwJvM8gY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a63d30a000000b004fcdbd4f9desi2623216pgg.351.2023.04.13.11.41.30; Thu, 13 Apr 2023 11:41:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iwJvM8gY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjDMSiw (ORCPT + 99 others); Thu, 13 Apr 2023 14:38:52 -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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.