From patchwork Fri Dec 18 14:17:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 7884691 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 53D1A9F32E for ; Fri, 18 Dec 2015 14:19:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60E81202B8 for ; Fri, 18 Dec 2015 14:19:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97E3520254 for ; Fri, 18 Dec 2015 14:19:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a9vsb-0007WA-Uy; Fri, 18 Dec 2015 14:19:34 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a9vrx-00076W-7L for linux-mediatek@lists.infradead.org; Fri, 18 Dec 2015 14:18:55 +0000 Received: by mail-wm0-x22c.google.com with SMTP id p187so66467241wmp.0 for ; Fri, 18 Dec 2015 06:18:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sZdn9NFBY4/85mf4dT06mBJxJsLVuD9tsiDjAU1SjKU=; b=U/yzlRsiyDjqP/NiW70eXe6M5jqoaH+uHxOWB6gJlrFdTybufNz9ZQ0HC2yWpD8/Mp DrF+ATxOS9T2jmjIiroP9D2CNi+7LW9Sx6Zcz/OJACh1q5KC0tOv7Bafz5Mp623Rn9MP UDy6dkSSolLDo39qFpSlV0UuUgxHCMe9Q3058= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sZdn9NFBY4/85mf4dT06mBJxJsLVuD9tsiDjAU1SjKU=; b=WFwJIH3BwTjQzWgxQCR3iUlBp41cJJNrtJRyw+2szgIWWwVKAdaoBioT0hQmDXAEBG falrHaUPxZ6xp6QmBb0i1wddPJ3KGtvRRA71EgvYlUYldIu084uTr6wPcVeYr5494ti7 neqs0bOkz5I9P8/GJt3OLMCaGWZktf4g/xPghxEANl9/mtTWcaHi539IpB15zFqVmZvj US0U6lt+U2Y0EBFm5XPKX4tWZ+oNXjpFLhc+o3ouGJ5hytvDh1a05DHKZcKH1JHE5zMU 7GNITISZeCz2hIk9gEQqGh3/htpgf1OP8D59/GjxeYavuu49FbdBW8KcnPtu0FGyZI7o je+Q== X-Gm-Message-State: ALoCoQngMeeXdMZouqdiGn2eHrIxIwddQLjLjiIlKBKKZwZ5sbs5m+N/vnpJ+u16Q6QrNRKLWHKoYry+KV9A1CrIO2f5jG96VA== X-Received: by 10.28.130.200 with SMTP id e191mr3340611wmd.38.1450448311558; Fri, 18 Dec 2015 06:18:31 -0800 (PST) Received: from localhost.localdomain ([78.210.255.2]) by smtp.gmail.com with ESMTPSA id ql10sm15010027wjc.23.2015.12.18.06.18.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 06:18:30 -0800 (PST) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 03/69] clocksource/drivers/mtk_timer: Fix memleak in mtk_timer_init() Date: Fri, 18 Dec 2015 15:17:16 +0100 Message-Id: <1450448302-27429-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450448302-27429-1-git-send-email-daniel.lezcano@linaro.org> References: <5672CB9E.7090707@linaro.org> <1450448302-27429-1-git-send-email-daniel.lezcano@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151218_061853_739797_FEE25A7B X-CRM114-Status: GOOD ( 10.16 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, "moderated list:ARM/Mediatek SoC..." , Matthias Brugger , mingo@kernel.org, linux-arm-kernel@lists.infradead.org, Alexey Klimov MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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: Alexey Klimov Add error path to clear evt struct allocated by kzalloc() in the beginning of function mtk_timer_init(). Acked-by: Matthias Brugger Signed-off-by: Alexey Klimov Signed-off-by: Daniel Lezcano --- drivers/clocksource/mtk_timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c index e1e0642..d67bc35 100644 --- a/drivers/clocksource/mtk_timer.c +++ b/drivers/clocksource/mtk_timer.c @@ -205,7 +205,7 @@ static void __init mtk_timer_init(struct device_node *node) evt->gpt_base = of_io_request_and_map(node, 0, "mtk-timer"); if (IS_ERR(evt->gpt_base)) { pr_err("Can't get resource\n"); - return; + goto err_kzalloc; } evt->dev.irq = irq_of_parse_and_map(node, 0); @@ -260,5 +260,7 @@ err_mem: iounmap(evt->gpt_base); of_address_to_resource(node, 0, &res); release_mem_region(res.start, resource_size(&res)); +err_kzalloc: + kfree(evt); } CLOCKSOURCE_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_timer_init);