From patchwork Sun Sep 17 12:43:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9954805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1AA8C6039A for ; Sun, 17 Sep 2017 12:44:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 156D128848 for ; Sun, 17 Sep 2017 12:44:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09E1128B5B; Sun, 17 Sep 2017 12:44:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 13D0128848 for ; Sun, 17 Sep 2017 12:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=ylRVmjsarw06F5LgN3oFcOc8krphVHNGZYkGVkl4N9A=; b=Zr0 679lPeaJ8m0GKaNkIyM5VHY9wl3Dlm+beC1rqAgdHB4oBZgcGpBsa6rXiUuuPS5HS3Da5JeioON+a KwAC5SMYDpUFjMhOVXEeZqHjG0vUH3TWFiN1vAKGZmhoBvBZ+ek+XvpJZEXaTwVAbbW+14x33z7xy r4AraxiHqny2W5lVVOdX8ISrtQcoAoo7tceOxeE8VsU7LKiFhUkQoGrBfdMdvAt8GjGCgpl/uDTbH XWKh+Ul8bZ5OS2O/hPxMLGqt2Qls3ihKBSsaTVAaAZsBB86vL+cslf4mlTHaJnEvTGgKWP/Vwo8LA 5h/0ZEYRlUt0lc6m6rBLPVjHbjjnbww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dtYvc-0006hS-AS; Sun, 17 Sep 2017 12:44:04 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dtYvQ-0006YN-41 for linux-arm-kernel@lists.infradead.org; Sun, 17 Sep 2017 12:44:02 +0000 Received: by mail-wr0-x241.google.com with SMTP id k20so3617974wre.1 for ; Sun, 17 Sep 2017 05:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9anbTLWIVBYhSWI0h8I9A9sjiC7YqQCSsEJzkzGFlLM=; b=P2C5h2G8sgeDveep8+p0uHre54htPwPcJcVfQA6rWp02R9nWy91PFZpkhaDyqhmiTv 8S+j2BRVSDUQWE0WwAQLYLdEiGMcbHkef2oA6DL7JZ4Bwx95vlq2ysBm0dV8LTA38DTc BB9/1AxhJihOwMsmKC6fHmZEDXxDcB9/Y2atmT1/jwGYKNjrwCu4PBSBOtDBYFdWAnVe DfZGvDERKJgwsu1c9Zz17t09D9ygrmlK+LDXWMn86UfWz7LCNPRsvOw8sQWNxABVIW8l ugmoZdRTbB3sUk3DAxJ67ZZXQra/WoI0mADeUXVs3+V5J59NSPKJKGbFAjHlLKfqvnue bO4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9anbTLWIVBYhSWI0h8I9A9sjiC7YqQCSsEJzkzGFlLM=; b=Bpg5A18dNxGjbJpvkHzymc6/4LIcYuIW5m0a+N/gPYgMwR9Qbt4RPlqI3Akbbi8lMC MNqhCdODJaI8BN7FWPQA6XZPBeH/ZCi9aLw3VsMqsaeP61yYC1J4E3izbStbsbLNz3pK XTqrNg5uHtx4GTXzfmv2og6i8LLTjVjBc3xbArSZF13vr1+vXhmM4bpTDPhHUlQ5y2CJ PlzT66JeN02ot3npcYpOevvYJT1iYxaOcPJhgbdyZeX/S/8C70DayfLXW9SBmup5aaLr 5Wt8EkzLhpCelbiUMzQqIGN+zY8qikAsAP7ULuCXDmfvEws1e7XquPGYeIRciTYmud1F KyIw== X-Gm-Message-State: AHPjjUhkN35XFnRBhqdZ+Nfc6yn7Ca6w7cu7dl5yVeJ1OaL++jXd80sg XZjoCT0U94Wxdw== X-Google-Smtp-Source: ADKCNb7zeE9iW9echFfkjtCwF3WF/BCJ25RYa+YZ8q4DTPiop1nFN4ToKPFpGvOZTnCnt0TIyT/2Jw== X-Received: by 10.223.176.132 with SMTP id i4mr25113730wra.13.1505652196502; Sun, 17 Sep 2017 05:43:16 -0700 (PDT) Received: from localhost.localdomain (cpc101300-bagu16-2-0-cust362.1-3.cable.virginm.net. [86.21.41.107]) by smtp.gmail.com with ESMTPSA id f19sm5946461wrf.85.2017.09.17.05.43.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 Sep 2017 05:43:15 -0700 (PDT) From: Sudip Mukherjee To: Alessandro Zummo , Alexandre Belloni , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH] rtc: sun6i: fix memory leak Date: Sun, 17 Sep 2017 13:43:10 +0100 Message-Id: <1505652190-4942-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170917_054400_682422_C9FE7EB9 X-CRM114-Status: GOOD ( 10.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sudip Mukherjee MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If 'clk_data' is not allocated we returned but we failed to free 'rtc'. Signed-off-by: Sudip Mukherjee --- drivers/rtc/rtc-sun6i.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index 3d2216c..5bc28ee 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -201,8 +201,10 @@ static void __init sun6i_rtc_clk_init(struct device_node *node) clk_data = kzalloc(sizeof(*clk_data) + (sizeof(*clk_data->hws) * 2), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + kfree(rtc); return; + } spin_lock_init(&rtc->lock);