[PATCH] reboot: hide unused hw_protection_attr

From: Arnd Bergmann
Date: Mon Feb 24 2025 - 09:19:34 EST


From: Arnd Bergmann <arnd@xxxxxxxx>

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")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
kernel/reboot.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/reboot.c b/kernel/reboot.c
index 5299790a2832..2d6a06fe6c66 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -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)
{
--
2.39.5