[PATCH] dmaengine: ioatdma: use !kstrtoint(), not sscanf()!=-1
From: Alexander A. Klimov
Date: Tue May 26 2026 - 02:14:25 EST
Depending on the user input, sscanf() may return 0 for 0 success.
But intr_coalesce_store() wants sscanf() to parse one number,
so expect 1 from sscanf(), not any int except -1.
While on it, fix typo in %du by using just %d,
as this interface expects %d or %d\n.
Latter made scripts/checkpatch.pl complain,
so use kstrtoint() instead of sscanf().
Fixes: 268e2519f5b7 ("dmaengine: ioatdma: Add intr_coalesce sysfs entry")
Signed-off-by: Alexander A. Klimov <grandmaster@xxxxxxxxxxxx>
---
drivers/dma/ioat/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
index e796ddb5383f..f59df569956a 100644
--- a/drivers/dma/ioat/sysfs.c
+++ b/drivers/dma/ioat/sysfs.c
@@ -144,7 +144,7 @@ size_t count)
int intr_coalesce = 0;
struct ioatdma_chan *ioat_chan = to_ioat_chan(c);
- if (sscanf(page, "%du", &intr_coalesce) != -1) {
+ if (!kstrtoint(page, 10, &intr_coalesce)) {
if ((intr_coalesce < 0) ||
(intr_coalesce > IOAT_INTRDELAY_MASK))
return -EINVAL;
--
2.54.0