]> www.infradead.org Git - users/jedix/linux-maple.git/commit
gpiolib: Fix crash on error in gpiochip_get_ngpios()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 13 Feb 2025 15:56:46 +0000 (17:56 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 13 Feb 2025 17:51:39 +0000 (18:51 +0100)
commit7b4aebeecbbd5b5fe73e35fad3f62ed21aa7ef44
treecddddaeb90f96da7969281f30093ac2d552e5e28
parentb9644fbfbcab13da7f8b37bef7c51e5b8407d031
gpiolib: Fix crash on error in gpiochip_get_ngpios()

The gpiochip_get_ngpios() uses chip_*() macros to print messages.
However these macros rely on gpiodev to be initialised and set,
which is not the case when called via bgpio_init(). In such a case
the printing messages will crash on NULL pointer dereference.
Replace chip_*() macros by the respective dev_*() ones to avoid
such crash.

Fixes: 55b2395e4e92 ("gpio: mmio: handle "ngpios" properly in bgpio_init()")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250213155646.2882324-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpiolib.c