Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5457578pxu; Tue, 22 Dec 2020 18:38:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjQ/9UlB43acWQG5QZ0qKz26nvGq4wWRPfPOkdQgQgIe+/fipfYw9yIEIUkhnE5h0Tvtcd X-Received: by 2002:a50:f299:: with SMTP id f25mr22648838edm.133.1608691130723; Tue, 22 Dec 2020 18:38:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608691130; cv=none; d=google.com; s=arc-20160816; b=fqdfbRdUrlJkpqNqMtX1j9dJCqnxz5Uf+1Irk5TSiuc13MVlTRivgdFRlB+mvSFIyK GOdvB5iEwpdbtBaHJGtO+6xqna5SxZhGtoIkOwhP4D9Y7BNUNy8aB7ZiTfwsOATZ7G7M qs2e5DTMcRL7c0qpDXU31aBIey6e18zmREjXsXbCDNTeKULrhpsiUHl5sez2u2Z+6mwK jc9JzImfeTvS8d5hZh/xM9JeCUaql82aJZ3OGIVOYAruizWiUkrtQ2HL4xpHoruwaTI3 6+mUNcz61ZyWionHTY5CCaJv5L5LHlDwtyRKj3tpadw//OS1CHcVLhvKrFckgBEoc2Ht aaTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=//qB5B4yu0g85TYKJj45qSV89hkoB/rrtt9deO6ALJM=; b=KECCpe61RC1WXfB2FVRR3XYthwIx0Qj/c4WIsBs0cg08K/tArz452YU0Seq5XWCqm+ RFvw7UW0aq5Es/S2uA9wFz/ipos6LtcR42WME7GGIkBNnwatfhOHcAm4RuNYS4La9NFn 627Ml4atxVN4i1Ps8udyNS+nddg7h+mAIxtUvvH/rT4x1+7qzpAa9FOKuD6XuBwqdjz6 znmvGPEQMLbL0VrXY+XMX84N+ZhxQ+IisnlQzm7TlfeL0xflOz6hw6kcuCmzBnK2Qsk6 tBChlWwvFD6wP9IU8FTIy9ahhhUQmX1RcAEhd8kLVIFKP7QTQZ/EOYSH8VLKqiXlemq4 ij8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QN7RUSFO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c25si14122791edx.588.2020.12.22.18.38.28; Tue, 22 Dec 2020 18:38:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QN7RUSFO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730674AbgLWCiQ (ORCPT + 99 others); Tue, 22 Dec 2020 21:38:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:51348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730151AbgLWCYL (ORCPT ); Tue, 22 Dec 2020 21:24:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 29F692333B; Wed, 23 Dec 2020 02:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608690236; bh=wJAXHu7zSNDaN3aC8gmRAMD2V4kupXCh6Z8grumo4Wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QN7RUSFOHe2UNDb6nEr80LBSAE97do2cgcxevRzS++g5WiueiqKK6anpoYajvlPGX rg+l2y9ankWzrx48sZ3YCdT/M4KW4WaQ2zY3PyPdHqFuJGmLCWN0KVIHmDUHR5VCve ud/pYfmdM2GxJ6mk8tw1oIL/NgTQ00/Mg0JG+bXAasNBA6T1JptqEPNc02mYmz11Q9 TPE2fVztGKs3PeiJtk4zkMOwKyw+iuNpX9YvpV3mQylb+odS2sTLHgcKn7Ij2/gDse 20CbuT2v1zcrWCNctJHKthfIqiI8iPXOGkB2fLVLqIJy/6BmCBeLDIl/C8ySp/buXi GyIoAl1rZ9hxA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yangtao Li , Yangtao Li , Viresh Kumar , Sasha Levin , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 50/66] cpufreq: sti-cpufreq: fix mem leak in sti_cpufreq_set_opp_info() Date: Tue, 22 Dec 2020 21:22:36 -0500 Message-Id: <20201223022253.2793452-50-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201223022253.2793452-1-sashal@kernel.org> References: <20201223022253.2793452-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yangtao Li [ Upstream commit 3a5e6732a74c44d7c78a764b9a7701135565df8f ] Use dev_pm_opp_put_prop_name() to avoid mem leak, which free opp_table. Signed-off-by: Yangtao Li Signed-off-by: Yangtao Li Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/cpufreq/sti-cpufreq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c index 6b5d241c30b70..01bf9e3a85772 100644 --- a/drivers/cpufreq/sti-cpufreq.c +++ b/drivers/cpufreq/sti-cpufreq.c @@ -226,7 +226,8 @@ static int sti_cpufreq_set_opp_info(void) opp_table = dev_pm_opp_set_supported_hw(dev, version, VERSION_ELEMENTS); if (IS_ERR(opp_table)) { dev_err(dev, "Failed to set supported hardware\n"); - return PTR_ERR(opp_table); + ret = PTR_ERR(opp_table); + goto err_put_prop_name; } dev_dbg(dev, "pcode: %d major: %d minor: %d substrate: %d\n", @@ -235,6 +236,10 @@ static int sti_cpufreq_set_opp_info(void) version[0], version[1], version[2]); return 0; + +err_put_prop_name: + dev_pm_opp_put_prop_name(opp_table); + return ret; } static int sti_cpufreq_fetch_syscon_registers(void) -- 2.27.0