From: Takashi Sakamoto Date: Sat, 12 Jul 2025 08:08:02 +0000 (+0900) Subject: timer: fix return value when failing devnode detection of ALSA Timer character device X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=a81b71751785aa3562794c92d91da4b0b3afe06c;p=alsa-gobject.git timer: fix return value when failing devnode detection of ALSA Timer character device 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 --- 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);