summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2026-06-26 13:07:18 +0200
committerMadhavan Srinivasan <maddy@linux.ibm.com>2026-07-31 17:01:42 +0530
commit7cc3d3fdc97fa32f1e1d7b15810e723fe524b0f8 (patch)
tree501dc54c4e333c9e97a809a3a8f1b853f9c08a87
parentc7b7cea42cd4977f95ce520400c9740712b909a2 (diff)
downloadlinux-7cc3d3fdc97fa32f1e1d7b15810e723fe524b0f8.tar.gz
linux-7cc3d3fdc97fa32f1e1d7b15810e723fe524b0f8.zip
powerpc/pseries: Simplify attribute description check in papr_init()
Check only the first byte instead of scanning the entire string with strnlen(). Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260626110718.4367-2-thorsten.blum@linux.dev
-rw-r--r--arch/powerpc/platforms/pseries/papr_platform_attributes.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/arch/powerpc/platforms/pseries/papr_platform_attributes.c b/arch/powerpc/platforms/pseries/papr_platform_attributes.c
index 9c3758aa54c6..aacdaa1ebf63 100644
--- a/arch/powerpc/platforms/pseries/papr_platform_attributes.c
+++ b/arch/powerpc/platforms/pseries/papr_platform_attributes.c
@@ -323,12 +323,8 @@ retry:
}
for (idx = 0; idx < num_attrs; idx++) {
- bool show_val_desc = true;
-
/* Do not add the value desc attr if it does not exist */
- if (strnlen(esi_attrs[idx].value_desc,
- sizeof(esi_attrs[idx].value_desc)) == 0)
- show_val_desc = false;
+ bool show_val_desc = *esi_attrs[idx].value_desc != '\0';
if (add_attr_group(be64_to_cpu(esi_attrs[idx].id),
&papr_groups[idx],