Skip to contentSkip to conversation

reboot: hide unused hw_protection_attr

PATCH In review Arnd Bergmann 2 participants 2 messages Feb 24, 2025 – Feb 25, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reboot: hide unused hw_protection_attr

From: Arnd Bergmann <[email protected]>

The reference to hw_protection_attr is inside of an #ifdef block, but the definition is not:

kernel/reboot.c:1092:30: error: unused variable 'hw_protection_attr' [-Werror,-Wunused-variable]

 1092 | static struct kobj_attribute hw_protection_attr = __ATTR_RW(hw_protection);
      |                              ^~~~~~~~~~~~~~~~~~

Add another #ifdef to match the first.

Fixes 6f0ec17b2d82 ("reboot: add support for configuring emergency hardware protection action")
---
 kernel/reboot.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/reboot.c +2 -0
index 5299790a2832..2d6a06fe6c66 100644
@@ -1071,6 +1071,7 @@ static int __init hw_protection_setup(char *str)
 }
 __setup("hw_protection=", hw_protection_setup);
 
+#ifdef CONFIG_SYSFS
 static ssize_t hw_protection_show(struct kobject *kobj,
 				  struct kobj_attribute *attr, char *buf)
 {
@@ -1090,6 +1091,7 @@ static ssize_t hw_protection_store(struct kobject *kobj,
 	return count;
 }
 static struct kobj_attribute hw_protection_attr = __ATTR_RW(hw_protection);
+#endif
 
 static int __init reboot_setup(char *str)
 {
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The reference to hw_protection_attr is inside of an #ifdef block, but the definition is not:

Quoted 8 lines

kernel/reboot.c:1092:30: error: unused variable 'hw_protection_attr' [-Werror,-Wunused-variable]

 1092 | static struct kobj_attribute hw_protection_attr = __ATTR_RW(hw_protection);
      |                              ^~~~~~~~~~~~~~~~~~

Add another #ifdef to match the first.

Fixes 6f0ec17b2d82 ("reboot: add support for configuring emergency hardware protection action")