[PATCH v2] ACPI /amba: Fix meaningless code for amba_register_dummy_clk()

Youwan Wang posted 1 patch 1 year, 6 months ago
There is a newer version of this series
drivers/acpi/arm64/amba.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
[PATCH v2] ACPI /amba: Fix meaningless code for amba_register_dummy_clk()
Posted by Youwan Wang 1 year, 6 months ago
Defining `amba_dummy_clk` as static is meaningless.

The amba_register_dummy_clk() function is static and
is called during initialization. I think 'amba_dummy_clk'
should be NULL each time when initializing

Signed-off-by: Youwan Wang <youwan@nfschina.com>
---
 drivers/acpi/arm64/amba.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/acpi/arm64/amba.c b/drivers/acpi/arm64/amba.c
index 60be8ee1dbdc..ef438417cc80 100644
--- a/drivers/acpi/arm64/amba.c
+++ b/drivers/acpi/arm64/amba.c
@@ -35,11 +35,7 @@ static const struct acpi_device_id amba_id_list[] = {
 
 static void amba_register_dummy_clk(void)
 {
-	static struct clk *amba_dummy_clk;
-
-	/* If clock already registered */
-	if (amba_dummy_clk)
-		return;
+	struct clk *amba_dummy_clk;
 
 	amba_dummy_clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, 0, 0);
 	clk_register_clkdev(amba_dummy_clk, "apb_pclk", NULL);
-- 
2.25.1
Re: [PATCH v2] ACPI /amba: Fix meaningless code for amba_register_dummy_clk()
Posted by Sudeep Holla 1 year, 6 months ago
On Mon, Jun 17, 2024 at 08:50:44AM +0800, Youwan Wang wrote:
> Defining `amba_dummy_clk` as static is meaningless.
> 
> The amba_register_dummy_clk() function is static and
> is called during initialization. I think 'amba_dummy_clk'
> should be NULL each time when initializing
>

LGTM, can't figure why this was done like this. Looked at v4.6 when this
was introduced, still can't get a clue.

Acked-by: Sudeep Holla <sudeep.holla@arm.com>

Please check and include all the maintainers correctly and repost this
patch with my ack. I don't understand how you chose the set of people
or list you have included here.

$ ./scripts/get_maintainer.pl -f drivers/acpi/arm64/amba.c

Also please include Catalin and Will who can pick up this patch and
route it through arm64 tree.

-- 
Regards,
Sudeep