[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260208221335.16030-1-trunixcodes@zohomail.com>
Date: Sun, 8 Feb 2026 14:13:35 -0800
From: trunix-creator <trunixcodes@...omail.com>
To: bleung@...omium.org
Cc: tzungbi@...nel.org,
groeck@...omium.org,
chrome-platform@...ts.linux.dev,
linux-kernel@...r.kernel.org,
trunix-creator <trunixcodes@...omail.com>
Subject: [PATCH] platform/chrome: cros_ec_lightbar: replace sscanf with kstrtouint
Replace the use of sscanf() with kstrtouint(), which is the favored kernel
API for parsing integers from strings. This avoids format string parsing
overhead and improves robustness.
Signed-off-by: trunix-creator <trunixcodes@...omail.com>
---
drivers/platform/chrome/cros_ec_lightbar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index 922758c2cec1..e455ff440b11 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -243,10 +243,10 @@ static ssize_t led_rgb_store(struct device *dev, struct device_attribute *attr,
if (!*buf)
break;
- ret = sscanf(buf, "%i", &val[i++]);
+ ret = kstrtouint(buf, 0, &val[i]);
if (ret == 0)
goto exit;
-
+ i++;
if (i == 4) {
param = (struct ec_params_lightbar *)msg->data;
param->cmd = LIGHTBAR_CMD_SET_RGB;
--
2.43.0
Powered by blists - more mailing lists