ASoC: Intel: sst: Replace sprintf() with sysfs_emit()
authorTakashi Iwai <tiwai@suse.de>
Mon, 1 Aug 2022 17:01:03 +0000 (19:01 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 15 Aug 2022 00:19:46 +0000 (01:19 +0100)
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>
Link: https://lore.kernel.org/r/20220801170108.26340-4-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/atom/sst/sst.c

index 160b50f479fb4f3a1171f0785a705a76fba8dc80..a0d29510d2bc486cbaeb7f3a9bae4287136e2aeb 100644 (file)
@@ -242,11 +242,11 @@ static ssize_t firmware_version_show(struct device *dev,
 
        if (ctx->fw_version.type == 0 && ctx->fw_version.major == 0 &&
            ctx->fw_version.minor == 0 && ctx->fw_version.build == 0)
-               return sprintf(buf, "FW not yet loaded\n");
+               return sysfs_emit(buf, "FW not yet loaded\n");
        else
-               return sprintf(buf, "v%02x.%02x.%02x.%02x\n",
-                              ctx->fw_version.type, ctx->fw_version.major,
-                              ctx->fw_version.minor, ctx->fw_version.build);
+               return sysfs_emit(buf, "v%02x.%02x.%02x.%02x\n",
+                                 ctx->fw_version.type, ctx->fw_version.major,
+                                 ctx->fw_version.minor, ctx->fw_version.build);
 
 }