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 32E28C001DF for ; Wed, 19 Jul 2023 19:57:01 +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=JobT/iswhijDJHtImLK8zn2zU1tjUh1dAYjaCEaYw4Y=; b=3aD+K8I8ED2rDe Ed53QtergjCo5EJ+i34tMlnbOqAnqKKkLUEc6KzQM07b1KBDF5YKIAX1IBHDlVvqfqsFea11np0EU 7Qdx8vXsdb8/2aE/OqydZDtHHdsnICM+GxMWfcIOh7xowFFAvMH1BalRrjLfIl1gOJ/DYVtLJe4HE SPY2HiH9qvTnZUzc+19iXhRAQ+oY1TPbrMhyEG4Bm0rzlyhe3jf7A/fTkbD8KXtY2fbLBd0Wk8l24 CR4GbMYEaE4JVAD6ikvRLC9b9TTBSG3gsJATKS7NUBDL8RWMsaaHSYv6ImCw60UCr/yeNEzM889CM /WJdo4uRODesge2JvfRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMDHr-008lkh-33; Wed, 19 Jul 2023 19:56:39 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMDHo-008ljb-2e for linux-arm-kernel@lists.infradead.org; Wed, 19 Jul 2023 19:56:38 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbd33a57dcso150785e9.0 for ; Wed, 19 Jul 2023 12:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689796591; x=1692388591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HkXfqP5HTc7LAT471rM4RtSLWgyDDA4RKqfhTSA/bHM=; b=Ur6fXRxqNVu6iJfQVwhSvCj8F/Ub6ioJGh7LOMqSUduRNJ5g723VsQ3iS5DTqLbDPi LM3fTKR8y2LLZkbP/K1+550CBQ6qVN7I/j9R/2LfV47wk0ygWxvRbAD+bJu0uxO0vJCS 1qTuPTjblcCvUd5+R2JwFuLqpVdGC02ud8M2sPOomwQNJKcUPCceKjlbI/Yi26s8fv8O tGFgSvHwXxNIEG136IZMdJYdeeGHq0NxbPfFMJ+cTHnL6YHY1ipyWJuVZhq4JnkMaWfl 5gdcBXWA8wxg7fW99UtS5X9wAeO3FEIfL6xEaA2OIoFO/z5d4jLZetn6i4xm97sfv1r6 0jUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689796591; x=1692388591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HkXfqP5HTc7LAT471rM4RtSLWgyDDA4RKqfhTSA/bHM=; b=J2TWP1fBnxwkpMWi5BbgfvQIbGe1sJgVmiXfeTovsUDj6NMGxdzGKoiXxFundApZXj pNoR/H/eaXc+nMlrF4IEN9GxRzh1V4G9cD6eMKrFrGOpuP4LUV1M7a6tgrL76msXVaXa APTphlxd/5VX00XntOju8j94WRkT+Dmdvq3Czdhg1pypRlyhOYbdnCiw1uVG0OeXHQug HFnt/tcktEy79dKbh5KRkOGajRCaTSDYdIbj855cHOa/LERyZe+IhxdePCPGdXi24vYE vQOaXefryAhncX6SAK6s8OPzy3o0kJIdo4BQUs5hutD+R6mxV+JWtblxAJ5Y66wzzlZV ew8Q== X-Gm-Message-State: ABy/qLaf6Db3A8Hw5ROrndsprwB7FYieuMOu/9KeM+gVXKGVxlXKYFh9 NI8TDx2p5PiW5dqn1YsmKiM= X-Google-Smtp-Source: APBJJlFr+x78/f/4ot76lC8mJxJeAa7g9BNSia7Aug5kEv7lgO0VS3TFcD/HAU9e5hLbCT97nsVT4w== X-Received: by 2002:a05:600c:2494:b0:3fb:b1fd:4183 with SMTP id 20-20020a05600c249400b003fbb1fd4183mr316396wms.12.1689796591016; Wed, 19 Jul 2023 12:56:31 -0700 (PDT) Received: from jernej-laptop.localnet (82-149-1-233.dynamic.telemach.net. [82.149.1.233]) by smtp.gmail.com with ESMTPSA id w13-20020a5d680d000000b00313e2abfb8dsm6093571wru.92.2023.07.19.12.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 12:56:30 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Vasily Khoruzhick , Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Chen-Yu Tsai , Samuel Holland , Mark Brown Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Mark Brown Subject: Re: [PATCH] thermal/drivers/sun8i: Free calibration nvmem after reading it Date: Wed, 19 Jul 2023 21:56:27 +0200 Message-ID: <13308789.uLZWGnKmhe@jernej-laptop> In-Reply-To: <20230719-thermal-sun8i-free-nvmem-v1-1-f553d5afef79@kernel.org> References: <20230719-thermal-sun8i-free-nvmem-v1-1-f553d5afef79@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230719_125636_980402_0D620312 X-CRM114-Status: GOOD ( 21.92 ) 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 Dne sreda, 19. julij 2023 ob 02:58:54 CEST je Mark Brown napisal(a): > 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 Best regards, Jernej > --- > 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 195f3c5d0b38..af3098717e3c 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; > } > > > --- > base-commit: fdf0eaf11452d72945af31804e2a1048ee1b574c > change-id: 20230718-thermal-sun8i-free-nvmem-3e9e21306e3e > > Best regards, _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel