From patchwork Sun Oct 25 23:21:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 7484371 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 0EB439F2F7 for ; Sun, 25 Oct 2015 23:22:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2259B207C5 for ; Sun, 25 Oct 2015 23:22:20 +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 4412C207DA for ; Sun, 25 Oct 2015 23:22:19 +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 1ZqUcE-00044N-Rv; Sun, 25 Oct 2015 23:22:18 +0000 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZqUcC-000423-Qz for linux-mediatek@lists.infradead.org; Sun, 25 Oct 2015 23:22:17 +0000 Received: by wicfv8 with SMTP id fv8so93237545wic.0 for ; Sun, 25 Oct 2015 16:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g0RRgLBWkrAxNgRpQx6xeKlbbA9b8Xi/GpSVVNH5T1Q=; b=HS8xLiRyW37A3RDe1fBHOdNG3DKZD4lg/lVqUPr+RZIbn0/hFFdJnKVxB3OfWAnYvN xGbAhSWaVhRY1Nr8oTcYcMOyNqR/07+RlnLigVXYnY3r8etV0db3zfBvV3PtoeiyYRjd a8GorZBOlANnsGX8s1JViXFUktQAIM2WkoWPySKOrksnryng8+6e8VhdHpP6mDtnWn24 onEdEKWmtUodd6TAPrQXMqxj/J0SeYsOAtYXuaw9uw3r6nAAiULh851oor4cqSamMLzi JBrnj67N33lq0b38OF6M/oSs37b5RsRQ7nJePgb/JBPkjabkbtrJcDRCgruSqMu8vUNE 1Mow== 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=g0RRgLBWkrAxNgRpQx6xeKlbbA9b8Xi/GpSVVNH5T1Q=; b=lLu0OwccknQk6DuYYCP/qXUlLajP88tfCeEqeilw3ifrB27YlVpjcVuVb+fp3WDvfC gJ6EjFNx9rcaD7zoqDU02t9wPniBxTgjRowyLHfeiUY+PbwE9dmevv+Bux3kS3qtE/vJ Z6XH/Tfkwar121/vPloHgKXImIL2XOB3FlihOHG9bZQ/Kl5fQwDy8e8h+Y5gAZuhFCCP Tqh1hTC088aNF4LMSt9FA7bx4KMyUlPw2hk5G0VwkgugHxkW9Pj0pBJM5qkF6Wd/TUHS xn2YzEiFvh250+wiDECqA15XPAH3NPqo+iw7wxhxoZkWCKaHv/y60TV6mLbb2GNjBg4p Hs/Q== X-Gm-Message-State: ALoCoQnkWIp4ONNZmz5mUuckuK0Dqd0ObwWvo1vjZaYT7gsYTNkWJPJS6YTCK/c5ZKPDzRK0Q64k X-Received: by 10.194.63.7 with SMTP id c7mr17174041wjs.70.1445815315391; Sun, 25 Oct 2015 16:21:55 -0700 (PDT) Received: from mtux.lan (host-2-101-188-230.as13285.net. [2.101.188.230]) by smtp.gmail.com with ESMTPSA id jj8sm11712633wid.2.2015.10.25.16.21.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Oct 2015 16:21:54 -0700 (PDT) From: Alexey Klimov To: daniel.lezcano@linaro.org, matthias.bgg@gmail.com, linux-kernel@vger.kernel.org, joe@perches.com Subject: [PATCH v3 3/3] clocksource: mtk_timer: fix memleak in mtk_timer_init() Date: Sun, 25 Oct 2015 23:21:24 +0000 Message-Id: <1445815284-10425-3-git-send-email-alexey.klimov@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445815284-10425-1-git-send-email-alexey.klimov@linaro.org> References: <1445815284-10425-1-git-send-email-alexey.klimov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151025_162217_022145_10A2D737 X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) 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: yingjoe.chen@mediatek.com, tglx@linutronix.de, Alexey Klimov , linux-mediatek@lists.infradead.org, klimov.linux@gmail.com 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,RP_MATCHES_RCVD,T_DKIM_INVALID,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 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 --- Changes in v3: -- none Changes in v2: -- added acked-by from Matthias 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 4ddddf4..454c00e 100644 --- a/drivers/clocksource/mtk_timer.c +++ b/drivers/clocksource/mtk_timer.c @@ -199,7 +199,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); @@ -254,5 +254,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);