[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240609-acpi-battery-cleanup-v1-4-344517bdca73@weissschuh.net>
Date: Sun, 09 Jun 2024 09:27:15 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: "Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>
Cc: linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 4/5] ACPI: battery: use sysfs_emit over sprintf
sysfs_emit validates assumptions made by sysfs and is the correct
mechanism to format data for sysfs.
Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
drivers/acpi/battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 984236b95dff..5f47bd58aff3 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -661,7 +661,7 @@ static ssize_t acpi_battery_alarm_show(struct device *dev,
{
struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
- return sprintf(buf, "%d\n", battery->alarm * 1000);
+ return sysfs_emit(buf, "%d\n", battery->alarm * 1000);
}
static ssize_t acpi_battery_alarm_store(struct device *dev,
--
2.45.2
Powered by blists - more mailing lists