]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ALSA: line6: Replace sprintf() with sysfs_emit()
authorTakashi Iwai <tiwai@suse.de>
Mon, 1 Aug 2022 16:56:39 +0000 (18:56 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 2 Aug 2022 14:03:49 +0000 (16:03 +0200)
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().

Link: https://lore.kernel.org/r/20220801165639.26030-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/line6/pod.c
sound/usb/line6/podhd.c

index 16e644330c4d63c9a0ff40548bac7e975b82a59f..cd41aa7f038513c4d90f788b50d78bc34320e91e 100644 (file)
@@ -235,7 +235,7 @@ static ssize_t serial_number_show(struct device *dev,
        struct snd_card *card = dev_to_snd_card(dev);
        struct usb_line6_pod *pod = card->private_data;
 
-       return sprintf(buf, "%u\n", pod->serial_number);
+       return sysfs_emit(buf, "%u\n", pod->serial_number);
 }
 
 /*
@@ -247,8 +247,8 @@ static ssize_t firmware_version_show(struct device *dev,
        struct snd_card *card = dev_to_snd_card(dev);
        struct usb_line6_pod *pod = card->private_data;
 
-       return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100,
-                      pod->firmware_version % 100);
+       return sysfs_emit(buf, "%d.%02d\n", pod->firmware_version / 100,
+                         pod->firmware_version % 100);
 }
 
 /*
@@ -260,7 +260,7 @@ static ssize_t device_id_show(struct device *dev,
        struct snd_card *card = dev_to_snd_card(dev);
        struct usb_line6_pod *pod = card->private_data;
 
-       return sprintf(buf, "%d\n", pod->device_id);
+       return sysfs_emit(buf, "%d\n", pod->device_id);
 }
 
 /*
index b24bc82f89e37c3911353fb8ce112f59953c613b..ffd8c157a28139ed376b9b22626678f37ea4660e 100644 (file)
@@ -146,7 +146,7 @@ static ssize_t serial_number_show(struct device *dev,
        struct snd_card *card = dev_to_snd_card(dev);
        struct usb_line6_podhd *pod = card->private_data;
 
-       return sprintf(buf, "%u\n", pod->serial_number);
+       return sysfs_emit(buf, "%u\n", pod->serial_number);
 }
 
 static ssize_t firmware_version_show(struct device *dev,
@@ -155,7 +155,7 @@ static ssize_t firmware_version_show(struct device *dev,
        struct snd_card *card = dev_to_snd_card(dev);
        struct usb_line6_podhd *pod = card->private_data;
 
-       return sprintf(buf, "%06x\n", pod->firmware_version);
+       return sysfs_emit(buf, "%06x\n", pod->firmware_version);
 }
 
 static DEVICE_ATTR_RO(firmware_version);