Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: barco-p50-gpio: 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 p50_gpio_get() is normalized
to the [0, 1] range.

Fixes: 86ef402d805d606a ("gpiolib: sanitize the return value of gpio_chip::get()")
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260318-barco-p50-gpio-set-v2-1-c0a4a6416163@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Dmitry Torokhov and committed by
Ilpo Järvinen
1c9d30d3 8786af77

+4 -1
+4 -1
drivers/platform/x86/barco-p50-gpio.c
··· 275 275 mutex_lock(&p50->lock); 276 276 277 277 ret = p50_send_mbox_cmd(p50, P50_MBOX_CMD_READ_GPIO, gpio_params[offset], 0); 278 - if (ret == 0) 278 + if (ret == 0) { 279 279 ret = p50_read_mbox_reg(p50, P50_MBOX_REG_DATA); 280 + if (ret >= 0) 281 + ret = !!ret; 282 + } 280 283 281 284 mutex_unlock(&p50->lock); 282 285