From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54F89EEB565 for ; Sat, 9 Sep 2023 01:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=981I5xQg2lBTEms43hCodUGVCElHIBWWcjfCvn4xJrQ=; b=k7ZoyAqfD2x0aI K+7NE6Jdq40IamtYcs1O/rdYZnew00jqHtPCIB+EBquCtcyRAQydp97mY1xw4q917z6dmL7P8qapL HYLr2oPWyOpZ056S5ocHqNSTn5muaCsZKk5+mPVO//h72nqSGWxgklTMPEMhgp6K3Q1SA7tqTfZaq G/6vD2m87Se6CanIYXVzfO+XQKwcF7ydSBKoUDmXdanSZhf/DierMmYQ6b09PHR0Vn4WCDCJnVu4z BYOJhTPxNnqw/tvuNOUv8eyPrAf3uUfs29f/xEzsxo30np/G50URx/vFgFZsC4DjeWM0S5xOGhcDL Zpgxq+y8KvldL8b02lBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qemX9-00EpUb-0Z; Sat, 09 Sep 2023 01:13:11 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qemX6-00EpUD-2V for linux-arm-kernel@lists.infradead.org; Sat, 09 Sep 2023 01:13:10 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C3B5ECE1D30; Sat, 9 Sep 2023 01:13:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CD0EC433B6; Sat, 9 Sep 2023 01:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694221984; bh=s7UGrDwp2Fbn1/Oq5TSE/75H8fK01vSD0DcAQNFWpLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H8vQbFWMMBCzENoxYfMp8Vc7W09HgWYbOJESgTgDL52LTsG1rwvJ16j5J+6kw4RgL M8HFbZ3TqUuQeoYqzPDgV9DzbEUqCuBdlrPR5NGznHNS8ezZBYiDKSQVkV6GdEJji0 kWr6n+V8BTJueuM4qzc5Ej91+46A42ZrxQ61HCv8uyXNTuea6FiZIGywMrUYDpNsCr AMtj7z/nCVFu1FnoZX75O5QZSjP6w/4K4It855qVxsQGg528yyFHVlKRt2Do1m2z7r mj/dF1GJ67LLmjgks5sgUSFtR8kGTBnBZkRIqQTCfImPJLWC+xTt52dx/LrM3gIcUc 9L9YZPmDe+ULg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mark Brown , Jernej Skrabec , Daniel Lezcano , Sasha Levin , anarsoul@gmail.com, tiny.windzz@gmail.com, rafael@kernel.org, wens@csie.org, samuel@sholland.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH AUTOSEL 6.5 6/6] thermal/drivers/sun8i: Free calibration nvmem after reading it Date: Fri, 8 Sep 2023 21:12:54 -0400 Message-Id: <20230909011254.3581788-6-sashal@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230909011254.3581788-1-sashal@kernel.org> References: <20230909011254.3581788-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.5.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230908_181309_000350_4527BC24 X-CRM114-Status: GOOD ( 15.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Mark Brown [ Upstream commit c51592a95f360aabf2b8a5691c550e1749dc41eb ] The sun8i thermal driver reads calibration data via the nvmem API at startup, updating the device configuration and not referencing the data again. Rather than explicitly freeing the nvmem data the driver relies on devm_ to release it, even though the data is never referenced again. The allocation is still tracked so it's not leaked but this is notable when looking at the code and is a little wasteful so let's instead explicitly free the nvmem after we're done with it. Signed-off-by: Mark Brown Acked-by: Jernej Skrabec Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20230719-thermal-sun8i-free-nvmem-v1-1-f553d5afef79@kernel.org Signed-off-by: Sasha Levin --- drivers/thermal/sun8i_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 195f3c5d0b388..af3098717e3c1 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -286,7 +286,7 @@ static int sun8i_ths_calibrate(struct ths_device *tmdev) size_t callen; int ret = 0; - calcell = devm_nvmem_cell_get(dev, "calibration"); + calcell = nvmem_cell_get(dev, "calibration"); if (IS_ERR(calcell)) { if (PTR_ERR(calcell) == -EPROBE_DEFER) return -EPROBE_DEFER; @@ -316,6 +316,8 @@ static int sun8i_ths_calibrate(struct ths_device *tmdev) kfree(caldata); out: + if (!IS_ERR(calcell)) + nvmem_cell_put(calcell); return ret; } -- 2.40.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel