From: Bartosz Golaszewski Date: Mon, 7 Apr 2025 07:08:15 +0000 (+0200) Subject: regulator: don't compare raw GPIO descriptor pointers X-Git-Tag: v6.16-rc1~167^2~15^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aaf6223ea2a1ff9316a81bf851fd5a0e82635b60;p=thirdparty%2Fkernel%2Flinux.git regulator: don't compare raw GPIO descriptor pointers There's no API contract saying that two GPIO descriptor pointers obtained with a call to gpiod_get() (or one of the variants), that refer to the same physical GPIO pin, always point to the same structure. Use the dedicated comparator function. Signed-off-by: Bartosz Golaszewski Link: https://patch.msgid.link/20250407-gpiod-is-equal-v1-2-7d85f568ae6e@linaro.org Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 90629a7566932..7a248dc8d2e2f 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2617,7 +2617,7 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev, mutex_lock(®ulator_list_mutex); list_for_each_entry(pin, ®ulator_ena_gpio_list, list) { - if (pin->gpiod == gpiod) { + if (gpiod_is_equal(pin->gpiod, gpiod)) { rdev_dbg(rdev, "GPIO is already used\n"); goto update_ena_gpio_to_rdev; }