summaryrefslogtreecommitdiff
path: root/include/linux/gpio
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2025-02-10 11:51:57 +0100
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2025-02-24 09:58:58 +0100
commitdcf8f3bffa2de2c7f3b5771b63605194ccd2286f (patch)
tree2d42dd0422ef63ee384a6cce78dbb163e3e69ba7 /include/linux/gpio
parent69920338f8130da929ade6f93e6fa3e0e68433ee (diff)
downloadlwn-dcf8f3bffa2de2c7f3b5771b63605194ccd2286f.tar.gz
lwn-dcf8f3bffa2de2c7f3b5771b63605194ccd2286f.zip
gpiolib: sanitize the return value of gpio_chip::set_config()
The return value of the set_config() callback may be propagated to user-space. If a bad driver returns a positive number, it may confuse user programs. Tighten the API contract and check for positive numbers returned by GPIO controllers. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20250210-gpio-sanitize-retvals-v1-3-12ea88506cb2@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'include/linux/gpio')
-rw-r--r--include/linux/gpio/driver.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index ce22c072337c..f2145e938b29 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -349,7 +349,8 @@ struct gpio_irq_chip {
* @set: assigns output value for signal "offset"
* @set_multiple: assigns output values for multiple signals defined by "mask"
* @set_config: optional hook for all kinds of settings. Uses the same
- * packed config format as generic pinconf.
+ * packed config format as generic pinconf. Must return 0 on success and
+ * a negative error number on failure.
* @to_irq: optional hook supporting non-static gpiod_to_irq() mappings;
* implementation may not sleep
* @dbg_show: optional routine to show contents in debugfs; default code