All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kukjin Kim <kgene@kernel.org>
To: "'Rafael J. Wysocki'" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: Lukasz Majewski <l.majewski@samsung.com>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	linux-samsung-soc@vger.kernel.org,
	Linux PM list <linux-pm@vger.kernel.org>,
	shailendra.capricorn@gmail.com
Subject: [PATCH] cpufreq: exynos: Fix for memory leak in case SoC name does not match
Date: Tue, 04 Aug 2015 16:45:16 +0900	[thread overview]
Message-ID: <04f401d0ce89$81073900$8315ab00$@kernel.org> (raw)

From: Shailendra Verma <shailendra.capricorn@gmail.com>

During probe free the memory allocated to "exynos_info" in case of
unknown SoC type.

Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
[k.kozlowski: Rebased the patch around if(of_machine_is_compatible)]
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
---
Hi Rafael and Viresh,

Since this is a fix to prevent memory leak, it would be better if
this could be sent to linus during -rc via cpufreq tree.

Thanks,
Kukjin

 drivers/cpufreq/exynos-cpufreq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index ae5b2bd..fa3dd84 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -180,7 +180,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)
 		ret = exynos5250_cpufreq_init(exynos_info);
 	} else {
 		pr_err("%s: Unknown SoC type\n", __func__);
-		return -ENODEV;
+		ret = -ENODEV;
 	}
 
 	if (ret)
@@ -188,12 +188,14 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)
 
 	if (exynos_info->set_freq == NULL) {
 		dev_err(&pdev->dev, "No set_freq function (ERR)\n");
+		ret = -EINVAL;
 		goto err_vdd_arm;
 	}
 
 	arm_regulator = regulator_get(NULL, "vdd_arm");
 	if (IS_ERR(arm_regulator)) {
 		dev_err(&pdev->dev, "failed to get resource vdd_arm\n");
+		ret = -EINVAL;
 		goto err_vdd_arm;
 	}
 
@@ -225,7 +227,7 @@ err_cpufreq_reg:
 	regulator_put(arm_regulator);
 err_vdd_arm:
 	kfree(exynos_info);
-	return -EINVAL;
+	return ret;
 }
 
 static struct platform_driver exynos_cpufreq_platdrv = {
-- 
2.0.0


             reply	other threads:[~2015-08-04  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04  7:45 Kukjin Kim [this message]
2015-08-06  0:23 ` Rafael J. Wysocki
2015-08-08  7:36   ` Krzysztof Kozlowski
2015-08-08 13:29     ` Viresh Kumar
2015-08-14  9:41     ` Rafael J. Wysocki
2015-08-14  9:34       ` Kukjin Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='04f401d0ce89$81073900$8315ab00$@kernel.org' \
    --to=kgene@kernel.org \
    --cc=k.kozlowski@samsung.com \
    --cc=l.majewski@samsung.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=shailendra.capricorn@gmail.com \
    --cc=viresh.kumar@linaro.org \
    --subject='Re: [PATCH] cpufreq: exynos: Fix for memory leak in case SoC name does not match' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.