diff mbox series

[v2,4/4] kselftest/alsa - conf: Stringify the printed errno in sysfs_get()

Message ID 20240107173704.937824-5-mirsad.todorovac@alu.unizg.hr (mailing list archive)
State Accepted
Commit fd38dd6abda589a8771e7872e4dea28c99c6a6ef
Headers show
Series kselftest: alsa: Fix a couple of format specifiers and function parameters | expand

Commit Message

Mirsad Todorovac Jan. 7, 2024, 5:37 p.m. UTC
GCC 13.2.0 reported the warning of the print format specifier:

conf.c: In function ‘sysfs_get’:
conf.c:181:72: warning: format ‘%s’ expects argument of type ‘char *’, \
			but argument 3 has type ‘int’ [-Wformat=]
  181 |                 ksft_exit_fail_msg("sysfs: unable to read value '%s': %s\n",
      |                                                                       ~^
      |                                                                        |
      |                                                                        char *
      |                                                                       %d

The fix passes strerror(errno) as it was intended, like in the sibling error
exit message.

Fixes: aba51cd0949ae ("selftests: alsa - add PCM test")
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-sound@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
---
v1 -> v2:
 Changed the subject line as suggested to reflect the style of the subsystem.
 No change to the code.

 tools/testing/selftests/alsa/conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Jan. 8, 2024, 5:37 p.m. UTC | #1
On Sun, Jan 07, 2024 at 06:37:08PM +0100, Mirsad Todorovac wrote:
> GCC 13.2.0 reported the warning of the print format specifier:

Acked-by: Mark Brown <broonie@kernel.org>
Mirsad Todorovac Jan. 9, 2024, 5:36 a.m. UTC | #2
On 1/8/2024 6:37 PM, Mark Brown wrote:
> On Sun, Jan 07, 2024 at 06:37:08PM +0100, Mirsad Todorovac wrote:
>> GCC 13.2.0 reported the warning of the print format specifier:
> 
> Acked-by: Mark Brown <broonie@kernel.org>

Thank you very much for the review.

I guess now patchwork will do the rest required.

Thanks,
Mirsad
diff mbox series

Patch

diff --git a/tools/testing/selftests/alsa/conf.c b/tools/testing/selftests/alsa/conf.c
index 00925eb8d9f4..89e3656a042d 100644
--- a/tools/testing/selftests/alsa/conf.c
+++ b/tools/testing/selftests/alsa/conf.c
@@ -179,7 +179,7 @@  static char *sysfs_get(const char *sysfs_root, const char *id)
 	close(fd);
 	if (len < 0)
 		ksft_exit_fail_msg("sysfs: unable to read value '%s': %s\n",
-				   path, errno);
+				   path, strerror(errno));
 	while (len > 0 && path[len-1] == '\n')
 		len--;
 	path[len] = '\0';