Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1467086lqh; Mon, 6 May 2024 08:31:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWFwNGHrjB7c7fYw+n+V8qGdw9vB53smZHGE0PAnkuJNPCKQV5HxPigWy6BWDkJUXmQjSWsWZj1ermI7ptU7XOW6X26+TwYyThi86g8/Q== X-Google-Smtp-Source: AGHT+IFeh4+I1yT9d2qvTLSX+1m1LVeaI/wSwUSZR1Vwjs2rCIUjdYxcaYX6Ek3GPjUZouDi7ZCl X-Received: by 2002:a05:6a21:1519:b0:1af:8c2f:5f5e with SMTP id nq25-20020a056a21151900b001af8c2f5f5emr8260977pzb.28.1715009461712; Mon, 06 May 2024 08:31:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715009461; cv=pass; d=google.com; s=arc-20160816; b=Uq/R0Rnv70jSbm3m1jumzvkGYTs6gkz9LkTrnEFp+dl7YYK7YC5K/dMDpid7BrnqJ9 DIatt/4hz46fzPdYaXpTSDaX5Ey7XCQjgzag0swV6F0xsbjQmeZ2nqoCqaH3BUQvFSak JiFmZWNTP76PDFyehfNF4xhp27ooGnRjgekGMjuuA/DtcH13nSp+8uG33Gr0bG8nXine IB9tkYca6Dbv+FElgu4Ri7TT+M1nKCKZJHZZ0av5gST5dkPbdAW71r1MVkIOmc7FOmMD +6vJZ9ew1bMBcJbdwtiPnrmN+27W7RnBNwemobXoIHika814yPCbCNzvzOToVK+Z7H7o fU5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=GJL1u5m+pLYItM9KAL3mbxkUQV/1xhwiHQhmsyGUc6M=; fh=PtjmF/a9NEgENTtOYouTX8Jmf9aDBXWIM2kiJkfr9Mo=; b=m8epAdFL4n/iHZFwpGC9+UNOjIpgdEknHPnIjmcRAoTDr1gsrBRKSK+m7lFsBv2gbH xQaL7q9b+BH714NXWZweQaN+BV7lf+BnyyDUqMfRTYOz4WxfuWYmwczl9sbARgBzUNQy VPEImQ3HKu65ka4qYhnnk9908sJaOzM0+8FHBE3NCxsaG9vfAZ7zyK67Bgqlo1fdrwd2 y856bzSg9a2/NEcnfY9hGP4MqMHQc+LOWLGv5hQUp+GJcaWUTp7S4N5Jb+wGD/LmxWln 8xlMbjhFxv2nOA4/DsaanUTDG2j3Cuaka5yywLKE6f5SeYPwWI9R4mgwFziSCEEVcb8U NoZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TgLLYqHC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-170074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170074-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p15-20020a056a000b4f00b006f480a7f376si1766900pfo.347.2024.05.06.08.31.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 08:31:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TgLLYqHC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-170074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170074-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 505B7283504 for ; Mon, 6 May 2024 15:31:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DE45155357; Mon, 6 May 2024 15:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TgLLYqHC" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD51415531A for ; Mon, 6 May 2024 15:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715009456; cv=none; b=f87ZfWLTfkHpoFnmLnu/Kg/vVrhTxSR7FWU0xGHc9uKBFw1n65hDaEm2YMKt2Bi7qrKKXJJxquPNA1NNlZQw4yA4gfbDU9YVyLJDuQr+BeQ6NkqNNOY3YZ9opYEbnAPKTTdPfd2z//ndsSyADe0QFjonkDcEOIGgevPO2rAKX8E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715009456; c=relaxed/simple; bh=0pDxkiEJ2LoRsQ/lAD4W6k/YMqHAvm09MqAFgXeqYUw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GE5GzM3NhWScjjkX22NFQ17aMNJtf/j2q1H5X4XyKY5h28/xbjlO10uwjWOUbcjBPLf7f+UT87dd9JzoNbgYf0WdA89nSTAi7iJPFYNCOu326mqOMYZwyCDGwhhYzcoIw+maCrARbbsv1qLY38r54j+ptCDPJ6pbuLVrxKGywgM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TgLLYqHC; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-51fdc9af005so3201897e87.3 for ; Mon, 06 May 2024 08:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715009453; x=1715614253; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=GJL1u5m+pLYItM9KAL3mbxkUQV/1xhwiHQhmsyGUc6M=; b=TgLLYqHC6a/dncS7wLYhezZbFdAg6FzAQyqMZpVgiwwYVWcBoudBYIj1Uw9eUZULyU mEMxiw7xF+eqQpXSEC0ZQoCzoQtIFX4ehCjQ17loRUJPt9qmSQ4B6j0kXzPDWKOsiYRd glxpxoE4O2ayGoyQhpQzaFe1OtTFIW0ymStcrlKkX/IrOWLhtl0kbGuzxxirMQN0p1SL kDP3TEDeU0UXrBIBZt0Kq3Dn05vLvDwkCvtRnBILD5lBEQ0UxLiM49x4JJnbybkoju/r GaKVF/Kw4JKiFAVEbCBoHOpiZAP+xy/aJ9SYNOVLm2MThFViqBEvZ5EcSSi2jxDO9r9P l8rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715009453; x=1715614253; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GJL1u5m+pLYItM9KAL3mbxkUQV/1xhwiHQhmsyGUc6M=; b=ZK36C5GgGsI+Pv6hcsMC3rLqHITNrMz6cRUInI0aFJdBaWY0fzOfJPnxbpS2+lx6j+ f7LJ+VT0txO6uAC4XjaABFmRUR2+THtbeU+HajkRCujAa34oPEa14Ohe7Z75c7KADjgX Y7ScwjlLa5ckpbtvbcjmhjbz0m8maUYMIz9KDcWIeb57xx6VDOloOtalDCg2pUoWRw3v zrcQIGDGgL3rTkblmIbzAIrZr+DGk+d9a8subKSpMtct5EvwGT4OZb9GFXypwDj0eWTz 1iE6wIad41133L3UhjPAgvqgKh4opBu36XOZ0fOuycStEayOXb+gmMelTpJYniTavIrn px0A== X-Forwarded-Encrypted: i=1; AJvYcCVd8ozTrdwzW1O4LvsGOVh2TlGu41NVyTUa8OJk9fzkf74G92vJEBv8DNYR9TuS0QgU2l18x80rprpEyPRZepsvzN2045lZy26UcysX X-Gm-Message-State: AOJu0YwhmXVvXc6Fl0zXi1CdgpZXmgG6hU26hwlfZ7CQ6ZN4vdP27KA+ LWppNnopA1eE7TZ/A4+87+F/v3QC7TH3f+dFz87p20vsx+6cpqRz8DogdymmPM8= X-Received: by 2002:ac2:54b9:0:b0:51f:3a04:ba9b with SMTP id w25-20020ac254b9000000b0051f3a04ba9bmr8461033lfk.22.1715009452471; Mon, 06 May 2024 08:30:52 -0700 (PDT) Received: from [192.168.1.20] (net-37-182-167-227.cust.vodafonedsl.it. [37.182.167.227]) by smtp.gmail.com with ESMTPSA id ww1-20020a170907084100b00a59cb8c93f3sm1632649ejb.58.2024.05.06.08.30.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 May 2024 08:30:51 -0700 (PDT) Message-ID: <2398ca58-eafc-46df-92c1-c03cd920fd06@gmail.com> Date: Mon, 6 May 2024 17:30:49 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2 v3] drivers: use __free attribute instead of of_node_put() To: Greg KH Cc: sudeep.holla@arm.com, javier.carrasco.cruz@gmail.com, julia.lawall@inria.fr, linux-kernel@vger.kernel.org, rafael@kernel.org, skhan@linuxfoundation.org, conor@kernel.org 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> Content-Language: en-US From: Vincenzo Mezzela In-Reply-To: <2024050148-dutiful-unsubtle-dbb1@gregkh> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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. 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. Is there anything else that can be done to further testing this changes? Thanks, Vincenzo