From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Yang Wang <kevinyang.wang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: hawking.zhang@amd.com, alexander.deucher@amd.com, asad.kamal@amd.com
Subject: Re: [PATCH] drm/amd/pm: Fix incomplete null pointer issue for smu v13.0.6
Date: Mon, 27 Oct 2025 13:13:54 +0530 [thread overview]
Message-ID: <fc5a13a8-12aa-46c9-a660-12ea7e99b3b4@amd.com> (raw)
In-Reply-To: <20251027072757.1267995-1-kevinyang.wang@amd.com>
On 10/27/2025 12:57 PM, Yang Wang wrote:
> the smu v13.0.6 driver should handle return value of smu_v13_0_6_print_clks()
> to avoid null pointer issue.
>
> Fixes: 0354cd650daa ("drm/amd/pm: Avoid writing nulls into `pp_od_clk_voltage`")
>
> Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
> ---
> .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 41 ++++++++++++++-----
> 1 file changed, 31 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> index 39ae6701147c..22fe4d3508fd 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> @@ -1514,9 +1514,14 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.uclk_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> - now, "mclk");
> + ret = smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "mclk");
Probably the fix needs to be in smu_v13_0_6_print_clks?
size += sysfs_emit_at(buf, size, "%d: %uMhz
%s\n", i,
clk1, (level == i) ? "*"
: "");
'size += to size =' so that it returns only the total size emitted by
the function.
That is the case for this condition now -
if (curr_clk < SMU_13_0_6_DSCLK_THRESHOLD)
Thanks,
Lijo
> + if (ret < 0)
> + return ret;
> +
> + size += ret;
>
> + break;
> case SMU_SOCCLK:
> ret = smu_v13_0_6_get_current_clk_freq_by_table(smu, SMU_SOCCLK,
> &now);
> @@ -1528,9 +1533,13 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.soc_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> - now, "socclk");
> + ret = smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "socclk");
> + if (ret < 0)
> + return ret;
>
> + size += ret;
> + break;
> case SMU_FCLK:
> ret = smu_v13_0_6_get_current_clk_freq_by_table(smu, SMU_FCLK,
> &now);
> @@ -1542,9 +1551,13 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.fclk_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> - now, "fclk");
> + ret = smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "fclk");
> + if (ret < 0)
> + return ret;
>
> + size += ret;
> + break;
> case SMU_VCLK:
> ret = smu_v13_0_6_get_current_clk_freq_by_table(smu, SMU_VCLK,
> &now);
> @@ -1556,9 +1569,13 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.vclk_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> - now, "vclk");
> + ret = smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "vclk");
> + if (ret < 0)
> + return ret;
>
> + size += ret;
> + break;
> case SMU_DCLK:
> ret = smu_v13_0_6_get_current_clk_freq_by_table(smu, SMU_DCLK,
> &now);
> @@ -1570,9 +1587,13 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.dclk_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> - now, "dclk");
> + ret = smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "dclk");
> + if (ret < 0)
> + return ret;
>
> + size += ret;
> + break;
> default:
> break;
> }
next prev parent reply other threads:[~2025-10-27 7:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 7:27 [PATCH] drm/amd/pm: Fix incomplete null pointer issue for smu v13.0.6 Yang Wang
2025-10-27 7:43 ` Lazar, Lijo [this message]
2025-10-27 7:46 ` Lazar, Lijo
2025-10-27 7:56 ` Wang, Yang(Kevin)
2025-10-27 8:06 ` Lazar, Lijo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc5a13a8-12aa-46c9-a660-12ea7e99b3b4@amd.com \
--to=lijo.lazar@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=asad.kamal@amd.com \
--cc=hawking.zhang@amd.com \
--cc=kevinyang.wang@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox