regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing
Seung-Woo Kim [Thu, 4 Dec 2014 10:17:17 +0000 (19:17 +0900)]
After freeing pin from regulator_ena_gpio_free, loop can access
the pin. So this patch fixes not to access pin after freeing.

Bug 1899974

Change-Id: I613a9ceca9471c93631231840ed61f86f6180850
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1463512
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/regulator/core.c

index c0d15fe..e9436c1 100644 (file)
@@ -1858,6 +1858,8 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev)
                                gpio_free(pin->gpio);
                                list_del(&pin->list);
                                kfree(pin);
+                               rdev->ena_pin = NULL;
+                               return;
                        } else {
                                pin->request_count--;
                        }