Skip to content

Commit 6c955a9

Browse files
committed
ALSA: line6: Replace sprintf() with sysfs_emit()
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/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 17daae7 commit 6c955a9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

sound/usb/line6/pod.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static ssize_t serial_number_show(struct device *dev,
235235
struct snd_card *card = dev_to_snd_card(dev);
236236
struct usb_line6_pod *pod = card->private_data;
237237

238-
return sprintf(buf, "%u\n", pod->serial_number);
238+
return sysfs_emit(buf, "%u\n", pod->serial_number);
239239
}
240240

241241
/*
@@ -247,8 +247,8 @@ static ssize_t firmware_version_show(struct device *dev,
247247
struct snd_card *card = dev_to_snd_card(dev);
248248
struct usb_line6_pod *pod = card->private_data;
249249

250-
return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100,
251-
pod->firmware_version % 100);
250+
return sysfs_emit(buf, "%d.%02d\n", pod->firmware_version / 100,
251+
pod->firmware_version % 100);
252252
}
253253

254254
/*
@@ -260,7 +260,7 @@ static ssize_t device_id_show(struct device *dev,
260260
struct snd_card *card = dev_to_snd_card(dev);
261261
struct usb_line6_pod *pod = card->private_data;
262262

263-
return sprintf(buf, "%d\n", pod->device_id);
263+
return sysfs_emit(buf, "%d\n", pod->device_id);
264264
}
265265

266266
/*

sound/usb/line6/podhd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static ssize_t serial_number_show(struct device *dev,
146146
struct snd_card *card = dev_to_snd_card(dev);
147147
struct usb_line6_podhd *pod = card->private_data;
148148

149-
return sprintf(buf, "%u\n", pod->serial_number);
149+
return sysfs_emit(buf, "%u\n", pod->serial_number);
150150
}
151151

152152
static ssize_t firmware_version_show(struct device *dev,
@@ -155,7 +155,7 @@ static ssize_t firmware_version_show(struct device *dev,
155155
struct snd_card *card = dev_to_snd_card(dev);
156156
struct usb_line6_podhd *pod = card->private_data;
157157

158-
return sprintf(buf, "%06x\n", pod->firmware_version);
158+
return sysfs_emit(buf, "%06x\n", pod->firmware_version);
159159
}
160160

161161
static DEVICE_ATTR_RO(firmware_version);

0 commit comments

Comments
 (0)