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
This commit is contained in:
Thorsten Blum
2026-06-26 13:07:18 +02:00
committed by Madhavan Srinivasan
parent c7b7cea42c
commit 7cc3d3fdc9

View File

@@ -323,12 +323,8 @@ static int __init papr_init(void)
}
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],