diff mbox series

ASoC: amd: ps: Fix -Wformat-truncation warning

Message ID 20230915082207.26200-1-tiwai@suse.de (mailing list archive)
State Accepted
Commit 925819c7969cc1453a3e8125787942d6127fa002
Headers show
Series ASoC: amd: ps: Fix -Wformat-truncation warning | expand

Commit Message

Takashi Iwai Sept. 15, 2023, 8:22 a.m. UTC
The compile warning with -Wformat-truncation at
sdw_amd_scan_controller() is false-positive; the max loop size is
AMD_SDW_MAX_MANAGERS (= 2), hence it fits with the given size.

For suppressing the warning, replace snprintf() with scnprintf().
As stated in the above, truncation doesn't matter.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/amd/ps/pci-ps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Sept. 16, 2023, 1:11 a.m. UTC | #1
On Fri, 15 Sep 2023 10:22:07 +0200, Takashi Iwai wrote:
> The compile warning with -Wformat-truncation at
> sdw_amd_scan_controller() is false-positive; the max loop size is
> AMD_SDW_MAX_MANAGERS (= 2), hence it fits with the given size.
> 
> For suppressing the warning, replace snprintf() with scnprintf().
> As stated in the above, truncation doesn't matter.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: amd: ps: Fix -Wformat-truncation warning
      commit: 925819c7969cc1453a3e8125787942d6127fa002

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
index 4af3c3665387..7e4c0ec9e56c 100644
--- a/sound/soc/amd/ps/pci-ps.c
+++ b/sound/soc/amd/ps/pci-ps.c
@@ -274,7 +274,7 @@  static int sdw_amd_scan_controller(struct device *dev)
 	dev_dbg(dev, "ACPI reports %d SoundWire Manager devices\n", count);
 	acp_data->sdw_manager_count = count;
 	for (index = 0; index < count; index++) {
-		snprintf(name, sizeof(name), "mipi-sdw-link-%d-subproperties", index);
+		scnprintf(name, sizeof(name), "mipi-sdw-link-%d-subproperties", index);
 		link = fwnode_get_named_child_node(acp_data->sdw_fw_node, name);
 		if (!link) {
 			dev_err(dev, "Manager node %s not found\n", name);