Skip to contentSkip to conversation

drm/amd/pm: Fix warning about helper function use

PATCH In review Lijo Lazar 2 participants 3 messages Jul 22

Subsystems (3)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amd/pm: Fix warning about helper function use

Use str_enabled_disabled to fix below warning
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c:920:3-56: opportunity for str_enabled_disabled(smu_feature_bits_is_set ( & feature_mask , feature_index ))

Fixes 7b88453a476c ("drm/amd/pm: Change get_enabled_mask signature")
---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -3
index 2bd3ea17e789..764f943df5a8 100644
@@ -965,9 +965,8 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
 			buf, size, "%02d. %-20s (%2d) : %s\n", count++,
 			smu_get_feature_name(smu, sort_feature[feature_index]),
 			feature_index,
-			smu_feature_bits_is_set(&feature_mask, feature_index) ?
-				"enabled" :
-				"disabled");
+			str_enabled_disabled(smu_feature_bits_is_set(
+				&feature_mask, feature_index)));
 	}
 
 	return size;
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw

AMD General

Quoted 1 line
Fixes 7b88453a476c ("drm/amd/pm: Change get_enabled_mask signature")

I suggest removing this line and refine the patch title.

The tag "Fixes" is used to indicate that a patch should be cherry-picked to the stable kernel branch as a bugfix. In this case, this is only a suggestion rather than a bug. No related issue was introduced in the original patch.

Ref:
static inline const char *str_enabled_disabled(bool v)

{
        return v ? "enabled" : "disabled";
}

With that fixed, this patch is

Best Regards,
Kevin

Quoted 42 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, July 22, 2026 14:56
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>; Wang, Yang(Kevin) <[email protected]>; kernel test robot <[email protected]>
Subject: [PATCH] drm/amd/pm: Fix warning about helper function use

Use str_enabled_disabled to fix below warning drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c:920:3-56: opportunity for str_enabled_disabled(smu_feature_bits_is_set ( & feature_mask , feature_index ))

Fixes 7b88453a476c ("drm/amd/pm: Change get_enabled_mask signature")
---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -3
index 2bd3ea17e789..764f943df5a8 100644
@@ -965,9 +965,8 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context
 *smu,
                      buf, size, "%02d. %-20s (%2d) : %s\n", count++,
                      smu_get_feature_name(smu, sort_feature[feature_index]),
                      feature_index,
-                     smu_feature_bits_is_set(&feature_mask, feature_index) ?
-                             "enabled" :
-                             "disabled");
+                     str_enabled_disabled(smu_feature_bits_is_set(
+                             &feature_mask, feature_index)));
      }
 
      return size;

--
2.49.0

#2 lore raw
Quoted 8 lines · Yang(Kevin)

AMD General

Quoted 1 line
Fixes 7b88453a476c ("drm/amd/pm: Change get_enabled_mask signature")

I suggest removing this line and refine the patch title.

The tag "Fixes" is used to indicate that a patch should be cherry-picked to the stable kernel branch as a bugfix. In this case, this is only a suggestion rather than a bug. No related issue was introduced in the original patch.

Quoted 9 lines

Ref:
static inline const char *str_enabled_disabled(bool v)

{
         return v ? "enabled" : "disabled";
}

With that fixed, this patch is

Yeah, the tags are copied from kernel test robot's mail. It's only a cocci script warning fix.

Thanks,
Lijo

Quoted 46 lines

Best Regards,
Kevin

Quoted 42 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, July 22, 2026 14:56
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>; Wang, Yang(Kevin) <[email protected]>; kernel test robot <[email protected]>
Subject: [PATCH] drm/amd/pm: Fix warning about helper function use

Use str_enabled_disabled to fix below warning drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c:920:3-56: opportunity for str_enabled_disabled(smu_feature_bits_is_set ( & feature_mask , feature_index ))

Fixes 7b88453a476c ("drm/amd/pm: Change get_enabled_mask signature")
---
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -3
index 2bd3ea17e789..764f943df5a8 100644
@@ -965,9 +965,8 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context
 *smu,
                       buf, size, "%02d. %-20s (%2d) : %s\n", count++,
                       smu_get_feature_name(smu, sort_feature[feature_index]),
                       feature_index,
-                     smu_feature_bits_is_set(&feature_mask, feature_index) ?
-                             "enabled" :
-                             "disabled");
+                     str_enabled_disabled(smu_feature_bits_is_set(
+                             &feature_mask, feature_index)));
       }
 
       return size;

--
2.49.0