From a81b71751785aa3562794c92d91da4b0b3afe06c Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sat, 12 Jul 2025 17:08:02 +0900 Subject: [PATCH] timer: fix return value when failing devnode detection of ALSA Timer character device MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When failing detecting devnode of ALSA Timer character device, the helper function returns negative value to the callers. This is overlooked in the previous code refactoring. It should return FALSE. This bug brings the following compiler warnings: ../src/timer/query.c: In function ‘alsatimer_get_device_id_list’: ../src/timer/query.c:122:13: warning: ‘fd’ may be used uninitialized [-Wmaybe-uninitialized] 122 | if (ioctl(fd, SNDRV_TIMER_IOCTL_NEXT_DEVICE, &id) < 0) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/timer/query.c:109:9: note: ‘fd’ was declared here 109 | int fd; | ^~ This commit fixes the bug. Fixes: 487c67a62e99 ("timer: query: rewrite public API to return gboolean according to GNOME convention") Signed-off-by: Takashi Sakamoto --- src/timer/query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timer/query.c b/src/timer/query.c index 23f7247..2ca9437 100644 --- a/src/timer/query.c +++ b/src/timer/query.c @@ -76,7 +76,7 @@ static gboolean open_fd(int *fd, GError **error) gboolean result; if (!alsatimer_get_devnode(&devname, error)) - return -1; + return FALSE; result = TRUE; *fd = open(devname, O_RDONLY); -- 2.47.3