This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 8fb4317a8239d88bfdee9901f9adf3446711b888
Author: yangsong8 <[email protected]>
AuthorDate: Wed Nov 11 15:24:17 2026 +0800

    drivers/ioexpander: fix the gpio_poll() build with no poll waiters
    
    gpio_poll() now takes dev->lock, but dev was only declared when
    CONFIG_DEV_GPIO_NPOLLWAITERS > 0, so the build failed with
    CONFIG_DEV_GPIO_NPOLLWAITERS=0.  Always look up the device.
    
    Assisted-by: Kiro:claude-opus-5-5
    Signed-off-by: yangsong8 <[email protected]>
---
 drivers/ioexpander/gpio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/ioexpander/gpio.c b/drivers/ioexpander/gpio.c
index a114d1088e1..cb4e2f3aeed 100644
--- a/drivers/ioexpander/gpio.c
+++ b/drivers/ioexpander/gpio.c
@@ -1067,14 +1067,13 @@ static int gpio_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
 static int gpio_poll(FAR struct file *filep,
                      FAR struct pollfd_s *fds, bool setup)
 {
-#if CONFIG_DEV_GPIO_NPOLLWAITERS > 0
   FAR struct inode *inode = filep->f_inode;
   FAR struct gpio_dev_s *dev = inode->i_private;
-  int i;
-#endif
-
   irqstate_t flags;
   int ret = OK;
+#if CONFIG_DEV_GPIO_NPOLLWAITERS > 0
+  int i;
+#endif
 
   /* Are we setting up the poll?  Or tearing it down? */
 

Reply via email to