diff mbox series

[4/8] ASoC: Intel: catpt: Replace sprintf() with sysfs_emit()

Message ID 20220801170108.26340-5-tiwai@suse.de
State Accepted
Commit 7ae8d8ea9427b6fb1ed04b02faf31ad5e3a6de8b
Headers show
Series ASoC: Replace sprintf() with sysfs_emit() | expand

Commit Message

Takashi Iwai Aug. 1, 2022, 5:01 p.m. UTC
For sysfs outputs, it's safer to use a new helper, sysfs_emit(),
instead of the raw sprintf() & co.  This patch replaces those usages
straightforwardly with a new helper, sysfs_emit().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/intel/catpt/sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Cezary Rojewski Aug. 2, 2022, 10:17 a.m. UTC | #1
On 2022-08-01 7:01 PM, Takashi Iwai wrote:
> For sysfs outputs, it's safer to use a new helper, sysfs_emit(),
> instead of the raw sprintf() & co.  This patch replaces those usages
> straightforwardly with a new helper, sysfs_emit().

Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
diff mbox series

Patch

diff --git a/sound/soc/intel/catpt/sysfs.c b/sound/soc/intel/catpt/sysfs.c
index 1bdbcc04dc71..9b6d2d93a2e7 100644
--- a/sound/soc/intel/catpt/sysfs.c
+++ b/sound/soc/intel/catpt/sysfs.c
@@ -27,8 +27,8 @@  static ssize_t fw_version_show(struct device *dev,
 	if (ret)
 		return CATPT_IPC_ERROR(ret);
 
-	return sprintf(buf, "%d.%d.%d.%d\n", version.type, version.major,
-		       version.minor, version.build);
+	return sysfs_emit(buf, "%d.%d.%d.%d\n", version.type, version.major,
+			  version.minor, version.build);
 }
 static DEVICE_ATTR_RO(fw_version);
 
@@ -37,7 +37,7 @@  static ssize_t fw_info_show(struct device *dev,
 {
 	struct catpt_dev *cdev = dev_get_drvdata(dev);
 
-	return sprintf(buf, "%s\n", cdev->ipc.config.fw_info);
+	return sysfs_emit(buf, "%s\n", cdev->ipc.config.fw_info);
 }
 static DEVICE_ATTR_RO(fw_info);