powerpc/pseries: Simplify attribute description check in papr_init()
PATCH 1/1 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 <[email protected]>
--- arch/powerpc/platforms/pseries/papr_platform_attributes.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/powerpc/platforms/pseries/papr_platform_attributes.c +1 -5
@@ -325,12 +325,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],
Quoted 4 lines · Thorsten Blum
Check only the first byte instead of scanning the entire string with
strnlen().
Applied to powerpc/next.
[1/1] powerpc/pseries: Simplify attribute description check in papr_init()
https://git.kernel.org/powerpc/c/7cc3d3fdc97fa32f1e1d7b15810e723fe524b0f8
cheers