ASoC: intel: Replace scnprintf() calls with sysfs_emit_at()
Subsystems (3)
PATCH 1/1 ASoC: intel: Replace scnprintf() calls with sysfs_emit_at()
For sysfs outputs, it's safer to use a new helper, sysfs_emit(), instead of the raw sprintf() & co. This patch replaces the open-code with a new helper, sysfs_emit_at(), by passing the string offset.
Signed-off-by zhaoxiao <[email protected]>
--- sound/soc/sof/intel/hda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/intel/hda.c +1 -1
@@ -574,7 +574,7 @@ static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, const char *le chip =get_chip_info (sdev->pdata);for (i =0 ; i <HDA_EXT_ROM_STATUS_SIZE ; i++) { value =snd_sof_dsp_read (sdev,HDA_DSP_BAR , chip->rom_status_reg + i *0x4 ); - len +=scnprintf (msg + len,sizeof (msg) - len," 0x%x" , value); + len +=sysfs_emit_at (msg, len," 0x%x" , value); }dev_printk (level, sdev->dev,"extended rom status: %s" , msg);
Signature · 1 line
2.20.1
Quoted 4 lines · zhaoxiao
For sysfs outputs, it's safer to use a new helper,
sysfs_emit(), instead of the rawsprintf()& co. This patch replaces the open-code with a new helper,sysfs_emit_at(), by passing the string offset.
Well, the function you've changed isn't used for sysfs at all...
Takashi
Quoted 22 lines
Signed-off-by zhaoxiao <[email protected]>--- sound/soc/sof/intel/hda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/sof/intel/hda.c +1
-1@@ -574,7 +574,7 @@ static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, const char *le chip =get_chip_info (sdev->pdata);for (i =0 ; i <HDA_EXT_ROM_STATUS_SIZE ; i++) { value =snd_sof_dsp_read (sdev,HDA_DSP_BAR , chip->rom_status_reg + i *0x4 ); - len +=scnprintf (msg + len,sizeof (msg) - len," 0x%x" , value); + len +=sysfs_emit_at (msg, len," 0x%x" , value); }dev_printk (level, sdev->dev,"extended rom status: %s" , msg);Signature · 1 line
2.20.1