Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2764368lqt; Tue, 23 Apr 2024 00:11:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU250MP93vOhYtm59ZyG2datbrVExV9uX5Eo/itYd4Ww5CcxURXYA0A8yRGzK0ZYjMpe2YYy/CdkdGgmeJU0a4r7E6adHucpAlJEeZPGw== X-Google-Smtp-Source: AGHT+IEg5Tq2wPB7Mj0o1osymTYNVLNAKrUKFFTJlR8CSYG/dC/oJQ0pPyGYQ4gK70CQ22AS8dto X-Received: by 2002:a2e:7c08:0:b0:2d8:d972:67e3 with SMTP id x8-20020a2e7c08000000b002d8d97267e3mr9321293ljc.5.1713856303744; Tue, 23 Apr 2024 00:11:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713856303; cv=pass; d=google.com; s=arc-20160816; b=R7ygLuaf+x7pd+AclHBT025zgi4loH+azRfvK8YBaT/DrixQTIK8pu4BcBi28ANhjq x8pt+rg1TGno94sk0vi+teeyEZWhEsXtacRUvahMkIHf9suHZ+QMxB0xJLIo6H0ejUBo uoH55vZix+G0MG2U8l0tZL1NePhqQ28D9iTH9LdRp21dktwhGnB7ijvkJYAWv9/xq1ps DaycO90mb2FeU76mdduyiHwIpyQBi2zxhnS4d7FYNBID2saPTQTpZWQkqfr6Qgb+8TQx qjf99kkCN83U+rv74wfsunDlR3R0jNGvearI8POnPpzaISUkuVdi2RC/lTc8bFmAXJeG B/iQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=kVygBsNtcrP1nWUhXC/dyte0z5MenHlyUiOgHcNUvQg=; fh=U2Fot6Zj1r1BLXZwviUPjYJRi5/H/R71atrmRdRqmKg=; b=x0EbFeo+RB0Rgk+gQHYGcAhL566IcDs20jLacP43xLfRoi+9N9LFa9bsZmZQIkgPo0 SHchEDn7/hELZcCMmjZRBHHtqndNIUAdIWhdvCxshPQXOH28/OMSH9Az0f3mN12cTYYx nmcdNAXsYXx4/bel7aZzuYoVD+VoTl7A816CUtgVFAlDluLrudKPdxaWMqVhz0qYbCkz 8NQE8hqqE9hDpZQbYeNTH9blanSXWYOILEsZQUmzHfD17bAsdJXIC15LrK9NAwk0cETE MGfG51P0DZojbyPcMcz94UHS7/oajCzVGYL//Y/pmkR05q5p+3scd+m6o3vuG3U8/kJ0 Lcng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=Rp5fpjlN; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-154590-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154590-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u22-20020a170906c41600b00a5876506e54si863380ejz.809.2024.04.23.00.11.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 00:11:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154590-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=Rp5fpjlN; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-154590-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154590-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5680B1F22874 for ; Tue, 23 Apr 2024 07:11:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C1A73A8D8; Tue, 23 Apr 2024 07:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="Rp5fpjlN" Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E14422C1AE; Tue, 23 Apr 2024 07:11:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.134.164.104 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713856279; cv=none; b=Q5kFuELBnA14UxWSokDNqtK2QMSNwYI7Cr1W/vnfexbGHIC4Kg4jlHfmSpOmTniXMj23VnnwypLaFzEJn04MpZOwjQVZz5Y7K5ajaklsR1jEPc6m2kdqv5Q0AfL5OnjXAwQm4b4v8gYick4FeTfve6toye0NX7tzgo1gL4iyzvE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713856279; c=relaxed/simple; bh=nLaGBHamuhtzaalMmDBdLqxZF1juSecJx5/vJnANln8=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=GSutYpGHZK1Nv2M+tfmUM8eygzkbS7e3LEuPVnBmhz/ul2JhUYTJwkrXL7GJeoHeDf/QTAq6MZet7Yedjj7vH41hSK5jA2O34JQPhXtSZZ1H/MG1bz8PiWpCwHTPhQ22ysgoS4hg/X3sqUzQVxliYIVm+j0d3SsUhp2x0K8TaTA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr; spf=pass smtp.mailfrom=inria.fr; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b=Rp5fpjlN; arc=none smtp.client-ip=192.134.164.104 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=kVygBsNtcrP1nWUhXC/dyte0z5MenHlyUiOgHcNUvQg=; b=Rp5fpjlNZQhd10e7B1pmmHySpUMks7ZNk3HFDqjKa7D5wPq3TofILbFD gGWYIVbxQ/7lqe+1KF0RxaxUUsXLdy5cPFM7NBcC36wraxS06M1xPVR/t tZlM70P2I2fLagsUhJlE6OG8cheLxe51OhS+4x6EXEFyverbGDU5JjibJ Q=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.07,222,1708383600"; d="scan'208";a="85487077" Received: from dmz02.dagstuhl.de (HELO hadrien) ([192.76.146.51]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2024 09:11:08 +0200 Date: Tue, 23 Apr 2024 09:11:07 +0200 (CEST) From: Julia Lawall To: Shivani Gupta cc: "Rafael J . Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, javier.carrasco.cruz@gmail.com Subject: Re: [PATCH] cpufreq: ti: Implement scope-based cleanup in ti_cpufreq_match_node() In-Reply-To: <20240423020727.776360-1-shivani07g@gmail.com> Message-ID: References: <20240423020727.776360-1-shivani07g@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Tue, 23 Apr 2024, Shivani Gupta wrote: > This patch modifies the ti_cpufreq_match_node() function to utilize the > __free() cleanup handler for automatically releasing the device > node when it goes out of scope. > > By moving the declaration to the initialization, the patch ensures that > the device node is properly managed throughout the function's scope, > thus eliminating the need for manual invocation of of_node_put(). > This approach reduces the potential for memory leaks. The code is fine. The log message is a bit verbose. Try to avoid referring to the patch. It's obvious that you are talking about the patch. Try to favor the imperative, so "Modify..." instead of "This patch modifies". julia > > Suggested-by: Julia Lawall > Signed-off-by: Shivani Gupta > --- > drivers/cpufreq/ti-cpufreq.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c > index 46c41e2ca727..714ed53753fa 100644 > --- a/drivers/cpufreq/ti-cpufreq.c > +++ b/drivers/cpufreq/ti-cpufreq.c > @@ -347,12 +347,10 @@ static const struct of_device_id ti_cpufreq_of_match[] = { > > static const struct of_device_id *ti_cpufreq_match_node(void) > { > - struct device_node *np; > + struct device_node *np __free(device_node) = of_find_node_by_path("/"); > const struct of_device_id *match; > > - np = of_find_node_by_path("/"); > match = of_match_node(ti_cpufreq_of_match, np); > - of_node_put(np); > > return match; > } > -- > 2.34.1 > >