From a81b71751785aa3562794c92d91da4b0b3afe06c Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sat, 12 Jul 2025 17:08:02 +0900 Subject: [PATCH 1/3] timer: fix return value when failing devnode detection of ALSA Timer character device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 23f72477..2ca94379 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); From 3b1d8a54f973a306849fe08dbd8c24edad69bcab Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sat, 12 Jul 2025 17:00:06 +0900 Subject: [PATCH 2/3] seq: fix return value when failing devnode detection of ALSA Sequencer character device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When failing detecting devnode of ALSA Sequencer 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/seq/query.c: In function ‘alsaseq_get_system_info’: ../src/seq/query.c:113:9: warning: ‘fd’ may be used uninitialized [-Wmaybe-uninitialized] 113 | if (ioctl(fd, SNDRV_SEQ_IOCTL_SYSTEM_INFO, info) < 0) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/seq/query.c:101:9: note: ‘fd’ was declared here 101 | int fd; | This commit fixes the bug. Fixes: 31eb1a62345c ("seq: query: rewrite public API to return gboolean according to GNOME convention") Signed-off-by: Takashi Sakamoto --- src/seq/query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/seq/query.c b/src/seq/query.c index b49c99bb..feddfda3 100644 --- a/src/seq/query.c +++ b/src/seq/query.c @@ -70,7 +70,7 @@ static gboolean open_fd(int *fd, GError **error) gboolean result; if (!alsaseq_get_seq_devnode(&devname, error)) - return -1; + return FALSE; result = TRUE; *fd = open(devname, O_RDONLY); From 7c57e1ef5f4dd493f2eed82db1bb3c98b1c1747a Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sat, 12 Jul 2025 21:24:18 +0900 Subject: [PATCH 3/3] timer: optimize to gi-docgen 2024.1 or later, approximately As long as building with gi-docgen 2025.3.1 in Ubuntu 25.04, some annotations for SlaveClass become invalid and causes some warnings. /usr/bin/gi-docgen generate --no-namespace-dir --config=doc/timer/alsatimer.toml --output-dir=doc/timer/alsatimer --content-dir=/home/mocchi/git/alsa-project.org/alsa-gobject/doc/timer src/timer/ALSATimer-0.0.gir WARNING: Unknown namespace SlaveClass slave_id. If the slave_class is [enum@SlaveClass.APPLICATION], the slave_id is for the PID of ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WARNING: Unknown namespace SlaveClass [enum@SlaveClass.SEQUENCER], the slave_id is the numeric ID of queue bound for timer device. ^~~~~~~~~~~~~~~~~~~~~~~~~~~ WARNING: Unknown namespace SlaveClass slave_id. If the slave_class is [enum@SlaveClass.APPLICATION], the slave_id is for the PID of ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WARNING: Unknown namespace SlaveClass [enum@SlaveClass.SEQUENCER], the slave_id is the numeric ID of queue bound for timer device. ^~~~~~~~~~~~~~~~~~~~~~~~~~~ WARNING: Unknown namespace SlaveClass slave_id. If the slave_class is [enum@SlaveClass.APPLICATION], the slave_id is for the PID of ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WARNING: Unknown namespace SlaveClass [enum@SlaveClass.SEQUENCER], the slave_id is the numeric ID of queue bound for timer device. ^~~~~~~~~~~~~~~~~~~~~~~~~~~ This commit suppresses the warnings by using the pattern of enum@class. Signed-off-by: Takashi Sakamoto --- src/timer/user-instance.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/timer/user-instance.c b/src/timer/user-instance.c index 6e2c7370..35ad3e92 100644 --- a/src/timer/user-instance.c +++ b/src/timer/user-instance.c @@ -332,9 +332,9 @@ gboolean alsatimer_user_instance_attach(ALSATimerUserInstance *self, ALSATimerDe * @error: A [struct@GLib.Error]. Error is generated with domain of `ALSATimer.UserInstanceError`. * * Attach the instance as an slave to another instance indicated by a pair of slave_class and - * slave_id. If the slave_class is [enum@SlaveClass:APPLICATION], the slave_id is for the PID of + * slave_id. If the slave_class is [enum@SlaveClass].APPLICATION, the slave_id is for the PID of * application process which owns the instance of timer. If the slave_class is - * [enum@SlaveClass:SEQUENCER], the slave_id is the numeric ID of queue bound for timer device. + * [enum@SlaveClass].SEQUENCER, the slave_id is the numeric ID of queue bound for timer device. * * The call of function executes `ioctl(2)` system call with `SNDRV_TIMER_IOCTL_SELECT` command * for ALSA timer character device.