From 73a054168842ccd0982bf9063e57c5a938f9f399 Mon Sep 17 00:00:00 2001 From: Hemant Gupta Date: Thu, 6 Oct 2011 20:44:14 +0530 Subject: cg2900: Fix Memory Leak during Driver Init. This patch fixes memory leak during driver initialization because pmu gpio was never freed in case of failure in snowball initialization. ST-Ericsson ID: 365769 ST-Ericcson FOSS-OUT-ID: Trivial ST-Ericsson Linux next: 365769 Change-Id: Ic6ed3e172ca46ccf0da443272845de984f0f5706 Signed-off-by: Hemant Gupta Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/33254 Reviewed-by: QABUILD Reviewed-by: Par-Gunnar HJALMDAHL --- drivers/staging/cg2900/devices-cg2900.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/staging/cg2900/devices-cg2900.c b/drivers/staging/cg2900/devices-cg2900.c index 4a13094a955..a2bd2c92f9c 100644 --- a/drivers/staging/cg2900/devices-cg2900.c +++ b/drivers/staging/cg2900/devices-cg2900.c @@ -181,7 +181,7 @@ static int dcg2900_init(struct cg2900_chip_dev *dev) "%s: Failed to get regulator '%s'\n", __func__, pdata->regulator_id); info->regulator_wlan = NULL; - goto err_handling; + goto err_handling_free_gpios; } /* Enable it also */ err = regulator_enable(info->regulator_wlan); @@ -201,6 +201,14 @@ finished: return 0; err_handling_put_reg: regulator_put(info->regulator_wlan); +err_handling_free_gpios: + if (info->bt_gpio != -1) + gpio_free(info->bt_gpio); + if (info->pmuen_gpio != -1) + gpio_free(info->pmuen_gpio); + if (info->gbf_gpio != -1) + gpio_free(info->gbf_gpio); + err_handling: kfree(info); return err; -- cgit v1.2.3