Skip to contentSkip to conversation

most: replace snprintf("%s") with strscpy in audio_probe_channel

PATCH In review Thorsten Blum 1 participant 2 messages Apr 29 – Jun 4 Most(r) technology driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 most: replace snprintf("%s") with strscpy in audio_probe_channel

Replace snprintf("%s") with the faster and more direct strscpy().

---
 drivers/most/most_snd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/most/most_snd.c +3 -4
index 68b9e6c64033..dc366813c31e 100644
@@ -16,6 +16,7 @@
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <linux/sched.h>
+#include <linux/string.h>
 #include <linux/kthread.h>
 #include <linux/most.h>
 
@@ -554,10 +555,8 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id,
 			   sizeof(*channel), &adpt->card);
 	if (ret < 0)
 		goto err_free_adpt;
-	snprintf(adpt->card->driver, sizeof(adpt->card->driver),
-		 "%s", DRIVER_NAME);
-	snprintf(adpt->card->shortname, sizeof(adpt->card->shortname),
-		 "Microchip INIC");
+	strscpy(adpt->card->driver, DRIVER_NAME);
+	strscpy(adpt->card->shortname, "Microchip INIC");
 	snprintf(adpt->card->longname, sizeof(adpt->card->longname),
 		 "%s at %s", adpt->card->shortname, iface->description);
 skip_adpt_alloc:
#1 lore raw

Gentle ping?

Quoted 32 lines · Thorsten Blum

Replace snprintf("%s") with the faster and more direct strscpy().

---
 drivers/most/most_snd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/most/most_snd.c +3 -4
index 68b9e6c64033..dc366813c31e 100644
@@ -16,6 +16,7 @@
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <linux/sched.h>
+#include <linux/string.h>
 #include <linux/kthread.h>
 #include <linux/most.h>
 
@@ -554,10 +555,8 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id,
 			   sizeof(*channel), &adpt->card);
 	if (ret < 0)
 		goto err_free_adpt;
-	snprintf(adpt->card->driver, sizeof(adpt->card->driver),
-		 "%s", DRIVER_NAME);
-	snprintf(adpt->card->shortname, sizeof(adpt->card->shortname),
-		 "Microchip INIC");
+	strscpy(adpt->card->driver, DRIVER_NAME);
+	strscpy(adpt->card->shortname, "Microchip INIC");
 	snprintf(adpt->card->longname, sizeof(adpt->card->longname),
 		 "%s at %s", adpt->card->shortname, iface->description);
 skip_adpt_alloc: