Skip to contentSkip to conversation

gpiolib: fix unwatch ioctl()

PATCH In review Kent Gibson 2 participants 2 messages Feb 24, 2020 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: fix unwatch ioctl()

Fix the field having a bit cleared by the unwatch ioctl().

Fixes 51c1064e82e7 ("gpiolib: add new ioctl() for monitoring changes in line info")

---

I had written some tests for v1 of the new ioctl patch series, and just updated them to run against the v6, which is now in gpio/for-next.

I found the Unwatch ioctl suffered a regression - it simply didn't work anymore, though it wasn't returning any error.

This patch fixes that regression.

 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib.c +1 -1
index 73a1e0831eeb..2411562a9bac 100644
@@ -1276,7 +1276,7 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		if (IS_ERR(desc))
 			return PTR_ERR(desc);
 
-		clear_bit(desc_to_gpio(desc), &desc->flags);
+		clear_bit(desc_to_gpio(desc), priv->watched_lines);
 		return 0;
 	}
 	return -EINVAL;
Signature · 1 line
2.25.0
#1 lore raw

pon., 24 lut 2020 o 15:50 Kent Gibson <[email protected]> napisał(a):

Quoted 33 lines

Fix the field having a bit cleared by the unwatch ioctl().

Fixes 51c1064e82e7 ("gpiolib: add new ioctl() for monitoring changes in line info")

---

I had written some tests for v1 of the new ioctl patch series, and just updated them to run against the v6, which is now in gpio/for-next.

I found the Unwatch ioctl suffered a regression - it simply didn't work anymore, though it wasn't returning any error.

This patch fixes that regression.

 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib.c +1 -2
index 73a1e0831eeb..2411562a9bac 100644
@@ -1276,7 +1276,7 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                if (IS_ERR(desc))
                        return PTR_ERR(desc);
 
-               clear_bit(desc_to_gpio(desc), &desc->flags);
+               clear_bit(desc_to_gpio(desc), priv->watched_lines);
                return 0;
        }
        return -EINVAL;
--
Quoted 2 lines

2.25.0

Thanks for catching this. Applied!

Bart