From patchwork Tue Aug 4 07:45:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kgene@kernel.org X-Patchwork-Id: 6934721 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 83FFCC05AC for ; Tue, 4 Aug 2015 07:45:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB437205CB for ; Tue, 4 Aug 2015 07:45:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C4C1820634 for ; Tue, 4 Aug 2015 07:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755351AbbHDHpa (ORCPT ); Tue, 4 Aug 2015 03:45:30 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:34263 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754432AbbHDHpT (ORCPT ); Tue, 4 Aug 2015 03:45:19 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NSJ02C9TS7H2L80@mailout1.samsung.com>; Tue, 04 Aug 2015 16:45:17 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [203.254.230.50]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id E4.70.29324.C8D60C55; Tue, 4 Aug 2015 16:45:17 +0900 (KST) X-AuditID: cbfee68d-f79106d00000728c-3e-55c06d8cc4bb Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 4A.85.07062.C8D60C55; Tue, 4 Aug 2015 16:45:16 +0900 (KST) Received: from DOKGENEKIM04 ([12.36.165.190]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NSJ00EFWS7G1T20@mmp1.samsung.com>; Tue, 04 Aug 2015 16:45:16 +0900 (KST) From: Kukjin Kim To: "'Rafael J. Wysocki'" , Viresh Kumar Cc: Lukasz Majewski , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, Linux PM list , 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 Message-id: <04f401d0ce89$81073900$8315ab00$@kernel.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdDOiXXt1TQ2LnmzTsOxy9yUgu44gg== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsVy+t8zI93e3AOhBu3vmSxevzC0ePNwM6PF 594jjBYzzu9jsjhz+hKrxa15M9ksNn71cGD32DnrLrvHnWt72Dy2XG1n8ejbsorR4/MmuQDW KC6blNSczLLUIn27BK6M070djAVH+Sqabr5lbWBs4Oli5OSQEDCRWL7qKzuELSZx4d56ti5G Lg4hgZWMErsnXmWGKXq8/ScrRGIpo8TK7j2MEM57Rok/M28AtXBwsAkoSzQ26YM0CAtoSSzc 0sQCYosIhEtMXHYerJ5Z4ByjxITOZkaIonCJFS+Wgq1mEVCV+Ll0PlicV8BC4tGi80wQtqDE j8n3wAYxAw1dv/M4E4QtL7F5zVuo6xQkdpx9zQixTE9ibdszqHoRiX0v3oEtlhC4xi7Rs62L FWKZgMS3yYdYQI6WEJCV2HQAao6kxMEVN1gmMIrPQrJ6FpLVs5CsnoVkxQJGllWMoqkFyQXF SelFhnrFibnFpXnpesn5uZsYIVHau4Px9gHrQ4wCHIxKPLw7nu0PFWJ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nFT+ZQsiXHweGy7Ilk4tPbboklDJ nKl8vh/0V0Tlb2xZmv7ju7Ef49MInbszGp3EVETWudoIKv7ZMsX3SOsmZ4/1qc7Ht/zpTn0s u8SgzufN+6zTPdmnak8EWSU+OP/Ybb6CnRJLcUaioRZzUXEiAM06O/UaAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shailendra Verma During probe free the memory allocated to "exynos_info" in case of unknown SoC type. Signed-off-by: Shailendra Verma Acked-by: Viresh Kumar Acked-by: Lukasz Majewski [k.kozlowski: Rebased the patch around if(of_machine_is_compatible)] Signed-off-by: Krzysztof Kozlowski Signed-off-by: Kukjin Kim --- 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 = {