mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 05:31:37 -04:00
gpio: tps65086: normalize return value of gpio_get
The GPIO get callback is expected to return 0 or 1 (or a negative error code). Ensure that the value returned by tps65086_gpio_get() is normalized to the [0, 1] range. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Link: https://patch.msgid.link/20260218190657.2974723-6-dmitry.torokhov@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
committed by
Bartosz Golaszewski
parent
e62b94a690
commit
9eb7ecfd20
@@ -50,7 +50,7 @@ static int tps65086_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return val & BIT(4 + offset);
|
||||
return !!(val & BIT(4 + offset));
|
||||
}
|
||||
|
||||
static int tps65086_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
|
||||
Reference in New Issue
Block a user