Skip to contentSkip to conversation

drm/amd/pm: Fix incomplete null pointer issue for smu v13.0.6

PATCH In review Yang Wang 2 participants 5 messages Oct 27, 2025

Subsystems (3)
lore
Share & tools
lore

Yang Wang

author
#0 lore raw

PATCH 1/1 drm/amd/pm: Fix incomplete null pointer issue for smu v13.0.6

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`")
---
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 41 ++++++++++++++-----
 1 file changed, 31 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +31 -10
index 39ae6701147c..22fe4d3508fd 100644
@@ -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");
+		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;
 	}
Signature · 1 line
2.34.1
#1 lore raw
Quoted 15 lines · Yang Wang

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`")
---
  .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 41 ++++++++++++++-----
  1 file changed, 31 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0 -0
index 39ae6701147c..22fe4d3508fd 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int smu_v13_0_6_print_clk_levels(struct smu_context *smu, · line 1518

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -2
@@ -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

Quoted 73 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +29 -8
+		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;
  	}
#2 lore raw
Quoted 28 lines · Lijo
Quoted 15 lines · Yang Wang

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`")

---
  .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 41 ++++++++++++++-----

  1 file changed, 31 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0 -0
index 39ae6701147c..22fe4d3508fd 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int smu_v13_0_6_print_clk_levels(struct · line 1517

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -2
@@ -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?

Quoted 7 lines

                        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.

Never mind, this is not going to work. The function may return the total size it emitted, or it also needs to adjust the below condition.

Thanks,
Lijo

Quoted 72 lines

That is the case for this condition now -

if (curr_clk < SMU_13_0_6_DSCLK_THRESHOLD)

Thanks,
Lijo

Quoted 64 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +5 -0
+        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);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +6 -2
@@ -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);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +6 -2
@@ -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);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +6 -2
@@ -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);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +6 -2
@@ -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;
      }

#3 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 1 line
Quoted 1 line

Probably the fix needs to be in smu_v13_0_6_print_clks?

I would like to keep the current code design where there are centralized exit points for called functions to match the kernel coding style requirement..

https://www.kernel.org/doc/html/v6.16/process/coding-style.html
7) Centralized exiting of functions

Best Regards,
Kevin

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, October 27, 2025 15:46
To: Wang, Yang(Kevin) <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Fix incomplete null pointer issue for smu v13.0.6

Quoted 34 lines · Lijo
Quoted 19 lines · Yang Wang

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")

---
  .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 41
++++++++++++++-----
  1 file changed, 31 insertions(+), 10 deletions(-)
(quoted diff) renamed from drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0 -0

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c index 39ae6701147c..22fe4d3508fd 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int smu_v13_0_6_print_clk_levels(struct · line 1519

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +3 -2
@@ -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?

Quoted 8 lines
                         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.

Never mind, this is not going to work. The function may return the total size it emitted, or it also needs to adjust the below condition.

Thanks,
Lijo

Quoted 84 lines

That is the case for this condition now -

if (curr_clk < SMU_13_0_6_DSCLK_THRESHOLD)

Thanks,
Lijo

Quoted 76 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +5 -0
+        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,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -1
-                          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,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -1
-                          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,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -1
-                          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,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -1
-                          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;
      }
#4 lore raw
Quoted 9 lines · Yang(Kevin)

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 1 line
Quoted 1 line

Probably the fix needs to be in smu_v13_0_6_print_clks?

I would like to keep the current code design where there are centralized exit points for called functions to match the kernel coding style requirement..

https://www.kernel.org/doc/html/v6.16/process/coding-style.html
7) Centralized exiting of functions

Not seeing a case for cleanup or multiple unwind steps in common exit point.

Anyway, if you prefer to keep this style, below one also needs a fix inside smu_v13_0_6_print_clks()

        if (curr_clk < SMU_13_0_6_DSCLK_THRESHOLD) {
                size = sysfs_emit_at(buf, size, "S: %uMhz *\n", curr_clk);

Thanks,
Lijo

Quoted 146 lines

Best Regards,
Kevin

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, October 27, 2025 15:46
To: Wang, Yang(Kevin) <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Fix incomplete null pointer issue for smu v13.0.6

Quoted 34 lines · Lijo
Quoted 19 lines · Yang Wang

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")

---
   .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 41
++++++++++++++-----
   1 file changed, 31 insertions(+), 10 deletions(-)
(quoted diff) renamed from drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0 -0

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c index 39ae6701147c..22fe4d3508fd 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int smu_v13_0_6_print_clk_levels(struct · line 1519

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +3 -2
@@ -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?

Quoted 8 lines
                          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.

Never mind, this is not going to work. The function may return the total size it emitted, or it also needs to adjust the below condition.

Thanks,
Lijo

Quoted 84 lines

That is the case for this condition now -

if (curr_clk < SMU_13_0_6_DSCLK_THRESHOLD)

Thanks,
Lijo

Quoted 76 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +5 -0
+        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,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -1
-                          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,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -1
-                          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,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -1
-                          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,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -1
-                          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;
       }