From: Seung-Woo Kim <sw0312.kim@xxxxxxxxxxx> After freeing pin from regulator_ena_gpio_free, loop can access the pin. So this patch fixes not to access pin after freeing. Signed-off-by: Seung-Woo Kim <sw0312.kim@xxxxxxxxxxx> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> (cherry picked from commit 60a2362f769cf549dc466134efe71c8bf9fbaaba) Signed-off-by: Amit Pundir <amit.pundir@xxxxxxxxxx> --- drivers/regulator/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 872e53f15590..b2e183627f53 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1720,6 +1720,8 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev) gpiod_put(pin->gpiod); list_del(&pin->list); kfree(pin); + rdev->ena_pin = NULL; + return; } else { pin->request_count--; } -- 2.7.4