mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] accel/amdxdna: Return error when setting clock failed for npu1
@ 2025-01-09 19:48 Lizhi Hou
  2025-01-09 19:55 ` Mario Limonciello
  0 siblings, 1 reply; 2+ messages in thread
From: Lizhi Hou @ 2025-01-09 19:48 UTC (permalink / raw)
  To: ogabbay, quic_jhugo, dri-devel
  Cc: Lizhi Hou, linux-kernel, min.ma, max.zhen, sonal.santan,
	king.tam, mario.limonciello, Dan Carpenter

Due to miss returning error when setting clock, the smatch static
checker reports warning:
  drivers/accel/amdxdna/aie2_smu.c:68 npu1_set_dpm()
  error: uninitialized symbol 'freq'.

Fixes: f4d7b8a6bc8c ("accel/amdxdna: Enhance power management settings")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/dri-devel/202267d0-882e-4593-b58d-be9274592f9b@stanley.mountain/
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
---
 drivers/accel/amdxdna/aie2_smu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/accel/amdxdna/aie2_smu.c b/drivers/accel/amdxdna/aie2_smu.c
index 73388443c676..d303701b0ded 100644
--- a/drivers/accel/amdxdna/aie2_smu.c
+++ b/drivers/accel/amdxdna/aie2_smu.c
@@ -64,6 +64,7 @@ int npu1_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
 	if (ret) {
 		XDNA_ERR(ndev->xdna, "Set npu clock to %d failed, ret %d\n",
 			 ndev->priv->dpm_clk_tbl[dpm_level].npuclk, ret);
+		return ret;
 	}
 	ndev->npuclk_freq = freq;
 
@@ -72,6 +73,7 @@ int npu1_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
 	if (ret) {
 		XDNA_ERR(ndev->xdna, "Set h clock to %d failed, ret %d\n",
 			 ndev->priv->dpm_clk_tbl[dpm_level].hclk, ret);
+		return ret;
 	}
 	ndev->hclk_freq = freq;
 	ndev->dpm_level = dpm_level;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] accel/amdxdna: Return error when setting clock failed for npu1
  2025-01-09 19:48 [PATCH v2] accel/amdxdna: Return error when setting clock failed for npu1 Lizhi Hou
@ 2025-01-09 19:55 ` Mario Limonciello
  0 siblings, 0 replies; 2+ messages in thread
From: Mario Limonciello @ 2025-01-09 19:55 UTC (permalink / raw)
  To: Lizhi Hou, ogabbay, quic_jhugo, dri-devel
  Cc: linux-kernel, min.ma, max.zhen, sonal.santan, king.tam, Dan Carpenter

On 1/9/2025 13:48, Lizhi Hou wrote:
> Due to miss returning error when setting clock, the smatch static
> checker reports warning:
>    drivers/accel/amdxdna/aie2_smu.c:68 npu1_set_dpm()
>    error: uninitialized symbol 'freq'.
> 
> Fixes: f4d7b8a6bc8c ("accel/amdxdna: Enhance power management settings")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/dri-devel/202267d0-882e-4593-b58d-be9274592f9b@stanley.mountain/
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

And pushed to drm-misc-next as:

0c2768bf81890 ("accel/amdxdna: Return error when setting clock failed 
for npu1")

> ---
>   drivers/accel/amdxdna/aie2_smu.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/accel/amdxdna/aie2_smu.c b/drivers/accel/amdxdna/aie2_smu.c
> index 73388443c676..d303701b0ded 100644
> --- a/drivers/accel/amdxdna/aie2_smu.c
> +++ b/drivers/accel/amdxdna/aie2_smu.c
> @@ -64,6 +64,7 @@ int npu1_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
>   	if (ret) {
>   		XDNA_ERR(ndev->xdna, "Set npu clock to %d failed, ret %d\n",
>   			 ndev->priv->dpm_clk_tbl[dpm_level].npuclk, ret);
> +		return ret;
>   	}
>   	ndev->npuclk_freq = freq;
>   
> @@ -72,6 +73,7 @@ int npu1_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
>   	if (ret) {
>   		XDNA_ERR(ndev->xdna, "Set h clock to %d failed, ret %d\n",
>   			 ndev->priv->dpm_clk_tbl[dpm_level].hclk, ret);
> +		return ret;
>   	}
>   	ndev->hclk_freq = freq;
>   	ndev->dpm_level = dpm_level;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-09 19:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-09 19:48 [PATCH v2] accel/amdxdna: Return error when setting clock failed for npu1 Lizhi Hou
2025-01-09 19:55 ` Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®