From: Thorsten Blum <thorsten.blum@linux.dev>
To: Michael Hennerich <michael.hennerich@analog.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>, linux-kernel@vger.kernel.org
Subject: [PATCH] misc: ad525x_dpot: Replace sprintf with sysfs_emit in sysfs_show_reg
Date: Mon, 3 Nov 2025 13:34:03 +0100 [thread overview]
Message-ID: <20251103123403.62076-2-thorsten.blum@linux.dev> (raw)
Replace sprintf() with sysfs_emit() in sysfs_show_reg(). sysfs_emit() is
preferred for formatting sysfs output as it provides better bounds
checking. No functional changes.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/misc/ad525x_dpot.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 04683b981e54..519f97089a00 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -419,7 +419,7 @@ static ssize_t sysfs_show_reg(struct device *dev,
s32 value;
if (reg & DPOT_ADDR_OTP_EN)
- return sprintf(buf, "%s\n", str_enabled_disabled(
+ return sysfs_emit(buf, "%s\n", str_enabled_disabled(
test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)));
mutex_lock(&data->update_lock);
@@ -437,9 +437,9 @@ static ssize_t sysfs_show_reg(struct device *dev,
*/
if (reg & DPOT_REG_TOL)
- return sprintf(buf, "0x%04x\n", value & 0xFFFF);
+ return sysfs_emit(buf, "0x%04x\n", value & 0xFFFF);
else
- return sprintf(buf, "%u\n", value & data->rdac_mask);
+ return sysfs_emit(buf, "%u\n", value & data->rdac_mask);
}
static ssize_t sysfs_set_reg(struct device *dev,
--
2.51.1
next reply other threads:[~2025-11-03 12:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 12:34 Thorsten Blum [this message]
2025-11-03 12:46 ` [PATCH] misc: ad525x_dpot: Replace sprintf with sysfs_emit in sysfs_show_reg Greg Kroah-Hartman
2025-11-03 13:11 ` Thorsten Blum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251103123403.62076-2-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.hennerich@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.