]> git.alsa-project.org Git - alsa-gobject.git/commit
timer: fix return value when failing devnode detection of ALSA Timer character device
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 12 Jul 2025 08:08:02 +0000 (17:08 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Sun, 13 Jul 2025 07:42:16 +0000 (16:42 +0900)
commit1d65665061d6fe4c23ae55b9be312197d02e93c5
tree0e227284271887c24ba3377f93a45c7c2f8fef38
parent1d796d993a3f2da9c1a8e6cbc1dacaf765152d64
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 <o-takashi@sakamocchi.jp>
src/timer/query.c