Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp424449lqh; Tue, 7 May 2024 03:32:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW95JR8rRHpRfWxef3lg8rnfhH9/v4Gi9auR4bukjwbtiw0h9Za/CSZ84uhrPrg5/lUfjJfvKibmxvbKixWpxFpL3afFC5pc2n24tZp/Q== X-Google-Smtp-Source: AGHT+IECBmgG6Aq8LBiRhxpsBmJyNC+0pHe/H4YcqXp0J3qVYONAP2zFac/NJLsOQlF2kb2SfgUI X-Received: by 2002:a9d:5f09:0:b0:6ee:39ac:a757 with SMTP id f9-20020a9d5f09000000b006ee39aca757mr14041033oti.21.1715077948165; Tue, 07 May 2024 03:32:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715077948; cv=pass; d=google.com; s=arc-20160816; b=d80rdAde4odBKNGL3CmmQOI8hjsDWiZErUUv9YbAwzuawQMn9VVbjzqMr+2RaD75po 7D2Laoj1ZLmurcXmhGZYSeruriWwZi/dX75ubi+FCnQXy0h8XTgGuS7PR2c3xHVi4OK+ BCcMZJUH9dFRajYXzuGZrndV6KLHScRflVGfZ341bsV71pMDzrDexvzr66ao1PeDjB7P tPA4xJygqIhRARsGgWxvJu4KzZ6UdvlCp8UbOq8rM/oiYkub/4pzskghNXwtLDaE9eri e0ZwWQGTHaz8Y1Hxyd6YUBm4AdGmddHzaSz9/ybkLRgRB2TeXmWcNdsXV3pTq14v6s8E tXFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=QAA3Py3tXbXd4xiOjBdbaFEx5rGq9HkGiL2DNto4olI=; fh=Yym8MHhi/vCIIMEMprZDvtVyJhEdKhuSDT4UFXCgNmg=; b=QU4Vq1gXkf/XMef4bSeh/DnaAjueFq/mk1jSv+xHFbU5/sDC5pEPSCtEQcMuQ15fz+ VQz3e504t1dW+w1JssrMsPqkkyipgFuYRNwP/DmISS6h236GuOTt713u3sU3OBffkU0I 4WfDmhEro8DpI4QhqgsXmXQ27LPW0kUgU1HTx2YFqVmuq5MCYECXSln6mqV9CTMb+yWH oXDhhOw/qRz28Yb7nh9ZNVI/s04zR70YZZNJ4XtE9VwG90VYRWbcJpuPtu2xW4xuFes1 GcmnB94rQoHuMleVmK40gZlykeInak3F19aSAxmcsRLjxPUqr/O8QNM8oPrL9LB0bX+5 IW5g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-171104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ay32-20020a05620a17a000b007929347dafcsi5799767qkb.431.2024.05.07.03.32.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 03:32:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-171104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DDFAF1C23136 for ; Tue, 7 May 2024 10:32:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE5E114D711; Tue, 7 May 2024 10:32:21 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86AA322064 for ; Tue, 7 May 2024 10:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715077941; cv=none; b=dBwOKLucCUL8rAuuLwplTDqVIVXzj+2XCpjnVpqTZGIhVe9WUNpm7FQnJz620lrIP+EAYqLCPau8CGdSx4VPfwRt8sRcILuigE0VsRuhCmWSFD4Mok6l+m4GQjBC6XifVn3hdx15iN2h9S5ML4jpfcL3nB5hzakiq+NbZ+xzJOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715077941; c=relaxed/simple; bh=u/BiEH3uaN9Y0kT7PVoWcpdxWQWEfIsnIh/Z0uYsUa0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=r7L+hJ7vF42uGbR0Kprj/PNAp/pdiSGaVfRl8EBrPNSRMhpyJJ5P83bczRyyFOaP13HLLx5I0UBWB9QpDsmBdalmi+cW41kQ5Gtw644tFJlGwC8tp1llvYry+XqWhpOcZL1xQN5NwMMlINeDvcYDUF4qi9gG6p7pXv9Oo4Hkgr4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D3FD51063; Tue, 7 May 2024 03:32:44 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A5ECB3F587; Tue, 7 May 2024 03:32:17 -0700 (PDT) Date: Tue, 7 May 2024 11:32:15 +0100 From: Sudeep Holla To: Vincenzo Mezzela Cc: Greg KH , javier.carrasco.cruz@gmail.com, Sudeep Holla , julia.lawall@inria.fr, linux-kernel@vger.kernel.org, rafael@kernel.org, skhan@linuxfoundation.org, conor@kernel.org Subject: Re: [PATCH 2/2 v3] drivers: use __free attribute instead of of_node_put() Message-ID: References: <20240424125401.oxvt5n64d7a57ge3@bogus> <20240501094313.407820-1-vincenzo.mezzela@gmail.com> <20240501094313.407820-3-vincenzo.mezzela@gmail.com> <2024050102-reshuffle-licking-f84e@gregkh> <673df61a-e0f5-450b-8fb4-746bc950e3d1@gmail.com> <2024050148-dutiful-unsubtle-dbb1@gregkh> <2398ca58-eafc-46df-92c1-c03cd920fd06@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 Content-Disposition: inline In-Reply-To: <2398ca58-eafc-46df-92c1-c03cd920fd06@gmail.com> On Mon, May 06, 2024 at 05:30:49PM +0200, Vincenzo Mezzela wrote: > > On 01/05/24 15:06, Greg KH wrote: > > On Wed, May 01, 2024 at 02:33:39PM +0200, Vincenzo Mezzela wrote: > > > On 01/05/24 12:48, Greg KH wrote: > > > > On Wed, May 01, 2024 at 11:43:13AM +0200, Vincenzo Mezzela wrote: > > > > > Introduce the __free attribute for scope-based resource management. > > > > > Resources allocated with __free are automatically released at the end of > > > > > the scope. This enhancement aims to mitigate memory management issues > > > > > associated with forgetting to release resources by utilizing __free > > > > > instead of of_node_put(). > > > > > > > > > > The declaration of the device_node used within the do-while loops is > > > > > moved directly within the loop so that the resource is automatically > > > > > freed at the end of each iteration. > > > > > > > > > > Suggested-by: Julia Lawall > > > > > Signed-off-by: Vincenzo Mezzela > > > > > --- > > > > > drivers/base/arch_topology.c | 51 +++++++++++++++--------------------- > > > > > 1 file changed, 21 insertions(+), 30 deletions(-) > > > > How was all of this tested? > > > > > > > > thanks, > > > > > > > > greg k-h > > > Hi, > > > > > > I just cross-compiled it for RISC-V to enable the config > > > GENERIC_ARCH_TOPOLOGY > > > and include arch_topology.c as well. > > Cross-compile is nice, how about running it? > > > > > Do you have any suggestion to trigger the affected code and perform some > > > testing? > > That is up to you to determine if you wish to modify it :) > > > > thanks, > > > > greg k-h > Hi, > > I've successfully run it on QEMU. There are no differences in the dmesg > after applying the patches. > For this patch, dmesg delta may not be of any use. > Furthermore, I've tracked the execution of the parse_dt_topology() which is > calling all the functions that I've modified with the patches and I checked > that of_node_put was correctly called at the end of each scope. > That should be good enough. > Is there anything else that can be done to further testing this changes? > I don't think there is much we can test other than what you have done already. If you fix the subject and any other comments me and others had suggested, I am happy to Ack. -- Regards, Sudeep