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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250624-monotype-disorder-aedee5ef7cfa@spud>
Date: Tue, 24 Jun 2025 16:59:58 +0100
From: Conor Dooley <conor@...nel.org>
To: Alok Tiwari <alok.a.tiwari@...cle.com>
Cc: conor.dooley@...rochip.com, daire.mcnamara@...rochip.com,
	mturquette@...libre.com, sboyd@...nel.org,
	linux-riscv@...ts.infradead.org, linux-clk@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] clk: microchip: mpfs: Fix incorrect MSSPLL ID in error
 message

On Sun, Jun 22, 2025 at 11:03:49AM -0700, Alok Tiwari wrote:
> The error message in mpfs_clk_register_mssplls() incorrectly
> printed a constant CLK_MSSPLL_INTERNAL instead of the actual
> PLL ID that failed to register.

Huh, that's weird. Did you actually encounter this happening, or is this
some sort of patch based on the output from a tool?
I ask because I don't see how this could ever actually report a
constant, when the array it loops over only has a single element.
Feels like we should just do something like the following (if we do
anything at all)

Cheers,
Conor.

diff --git a/drivers/clk/microchip/clk-mpfs.c b/drivers/clk/microchip/clk-mpfs.c
index c22632a7439c5..ed6d5e6ff98ec 100644
--- a/drivers/clk/microchip/clk-mpfs.c
+++ b/drivers/clk/microchip/clk-mpfs.c
@@ -148,22 +148,18 @@ static struct mpfs_msspll_hw_clock mpfs_msspll_clks[] = {
 };
 
 static int mpfs_clk_register_mssplls(struct device *dev, struct mpfs_msspll_hw_clock *msspll_hws,
-				     unsigned int num_clks, struct mpfs_clock_data *data)
+				     struct mpfs_clock_data *data)
 {
-	unsigned int i;
+	struct mpfs_msspll_hw_clock *msspll_hw = &msspll_hws[0];
 	int ret;
 
-	for (i = 0; i < num_clks; i++) {
-		struct mpfs_msspll_hw_clock *msspll_hw = &msspll_hws[i];
+	msspll_hw->base = data->msspll_base;
+	ret = devm_clk_hw_register(dev, &msspll_hw->hw);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to register msspll id: %d\n",
+				     CLK_MSSPLL_INTERNAL);
 
-		msspll_hw->base = data->msspll_base;
-		ret = devm_clk_hw_register(dev, &msspll_hw->hw);
-		if (ret)
-			return dev_err_probe(dev, ret, "failed to register msspll id: %d\n",
-					     CLK_MSSPLL_INTERNAL);
-
-		data->hw_data.hws[msspll_hw->id] = &msspll_hw->hw;
-	}
+	data->hw_data.hws[msspll_hw->id] = &msspll_hw->hw;
 
 	return 0;
 }
@@ -386,8 +382,7 @@ static int mpfs_clk_probe(struct platform_device *pdev)
 	clk_data->dev = dev;
 	dev_set_drvdata(dev, clk_data);
 
-	ret = mpfs_clk_register_mssplls(dev, mpfs_msspll_clks, ARRAY_SIZE(mpfs_msspll_clks),
-					clk_data);
+	ret = mpfs_clk_register_mssplls(dev, mpfs_msspll_clks, clk_data);
 	if (ret)
 		return ret;
 

> 
> Update it to msspll_hw->id for accurate diagnostics
> 
> Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>
> ---
>  drivers/clk/microchip/clk-mpfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/microchip/clk-mpfs.c b/drivers/clk/microchip/clk-mpfs.c
> index c22632a7439c5..d12b7120f16ff 100644
> --- a/drivers/clk/microchip/clk-mpfs.c
> +++ b/drivers/clk/microchip/clk-mpfs.c
> @@ -160,7 +160,7 @@ static int mpfs_clk_register_mssplls(struct device *dev, struct mpfs_msspll_hw_c
>  		ret = devm_clk_hw_register(dev, &msspll_hw->hw);
>  		if (ret)
>  			return dev_err_probe(dev, ret, "failed to register msspll id: %d\n",
> -					     CLK_MSSPLL_INTERNAL);
> +					     msspll_hw->id);
>  
>  		data->hw_data.hws[msspll_hw->id] = &msspll_hw->hw;
>  	}
> -- 
> 2.46.0
> 

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ