Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2775761imj; Mon, 11 Feb 2019 08:17:08 -0800 (PST) X-Google-Smtp-Source: AHgI3IZPtTTGuhFbEPb5UxHHxvlFAxXpJl95RoggDWRd1LiqYTsatQv34J334ZZLaC8DyskVHKzW X-Received: by 2002:a65:60c5:: with SMTP id r5mr19362501pgv.427.1549901828233; Mon, 11 Feb 2019 08:17:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901828; cv=none; d=google.com; s=arc-20160816; b=YI02xuoV33K1zmu8c4glNEB0NyJmykCPR+C/dRqKlbzMOatYaj9pFbtYE2eTg/py+l p6aN68cFLmG52wjjqQOUOXJNWjPKhiWOHPQQZyzy8UZCMaYfWxjh78LuyJKPf+I+jPnF fie/EnyQy2ZU3KTC5CGDO/MEBNlcu1CF2CjQZq0g56Afkc4EDnX9flxUagRD63qEsftJ NMOZORG2oisoycTSA/hFytCBZuQ7uypbEJutU+1HAzvCgq0uLR2ZMdMZr6iCWmH5Q7bf AObg+g2nhzfo0P+LTIF3XwNf89lTY0hDSBWg/Z9KLHjJNbSf3OHUVq7ADBMSq+Rbthsp V8fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wRCSR2bJXIkzx7GqaS0nBKNtUyVEA9tYMhkJtf/ylng=; b=qmLfsR0mmI+UMG/eSczX+CwT8F3S53CxG1SD3lRKD/PIN5Srfcur7VTN1wwSh33o2n caPFgPXHHZG43qbhL5IWV1O20jmTrIA36PM/abfMyFQ//4VoCpor3K3zDuEhZQGsznBs VkUSvm0xg+Y4srmsoSzMCu+mOwSvgU6ekeF1riUpZfrSEz0yQaoPgbESQ4aeRC3qjjBe 6Fd23c2aPcsJ9P9h6Zn87Sbuw4ibsRbzlU1UKn230rRScPUjPgaFPjNu6JHfMiWGhdD/ i+4xLVZt01f4vTdcODsTTtyyKnEyP2SwUMcAtVZNmof5aLxPKYSWfLRQeiEMmd97VhHJ 5/Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dmNAJK0h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si10423387pgn.32.2019.02.11.08.16.49; Mon, 11 Feb 2019 08:17:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dmNAJK0h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728239AbfBKQO2 (ORCPT + 99 others); Mon, 11 Feb 2019 11:14:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:54338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727168AbfBKOVa (ORCPT ); Mon, 11 Feb 2019 09:21:30 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A976E222B5; Mon, 11 Feb 2019 14:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894890; bh=qscIGtc1GttMLfFy3nMbx3N93isr3sYtQJR8C9roDCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmNAJK0hOV1pHtLhT9t1EkulbwvofKrBTP51RMHyRpUGmnFU4/iClErL/62Ojcftm kvrgJNsDO0Ye+HWDfzL8+t0LSvY8kke6lQCUgm2anXdyEsbRXNAoZ19njnYCtj/k1c nocvlp5dSVn9m1Z89yyLZqXYChXjKvn+g+B2YgsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Wang , Stephen Boyd , Sasha Levin Subject: [PATCH 4.20 023/352] clk: boston: fix possible memory leak in clk_boston_setup() Date: Mon, 11 Feb 2019 15:14:10 +0100 Message-Id: <20190211141847.827562703@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 46fda5b5067a391912cf73bf3d32c26b6a22ad09 ] Smatch report warnings: drivers/clk/imgtec/clk-boston.c:76 clk_boston_setup() warn: possible memory leak of 'onecell' drivers/clk/imgtec/clk-boston.c:83 clk_boston_setup() warn: possible memory leak of 'onecell' drivers/clk/imgtec/clk-boston.c:90 clk_boston_setup() warn: possible memory leak of 'onecell' 'onecell' is malloced in clk_boston_setup(), but not be freed before leaving from the error handling cases. Signed-off-by: Yi Wang Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/imgtec/clk-boston.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/clk/imgtec/clk-boston.c b/drivers/clk/imgtec/clk-boston.c index 15af423cc0c9..f5d54a64d33c 100644 --- a/drivers/clk/imgtec/clk-boston.c +++ b/drivers/clk/imgtec/clk-boston.c @@ -73,27 +73,32 @@ static void __init clk_boston_setup(struct device_node *np) hw = clk_hw_register_fixed_rate(NULL, "input", NULL, 0, in_freq); if (IS_ERR(hw)) { pr_err("failed to register input clock: %ld\n", PTR_ERR(hw)); - return; + goto error; } onecell->hws[BOSTON_CLK_INPUT] = hw; hw = clk_hw_register_fixed_rate(NULL, "sys", "input", 0, sys_freq); if (IS_ERR(hw)) { pr_err("failed to register sys clock: %ld\n", PTR_ERR(hw)); - return; + goto error; } onecell->hws[BOSTON_CLK_SYS] = hw; hw = clk_hw_register_fixed_rate(NULL, "cpu", "input", 0, cpu_freq); if (IS_ERR(hw)) { pr_err("failed to register cpu clock: %ld\n", PTR_ERR(hw)); - return; + goto error; } onecell->hws[BOSTON_CLK_CPU] = hw; err = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, onecell); if (err) pr_err("failed to add DT provider: %d\n", err); + + return; + +error: + kfree(onecell); } /* -- 2.19.1