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 C6B22C3DA4A for ; Fri, 12 Jul 2024 09:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ud2L63m6lfr/M2Mr6IxkqT38hdjkayIOqwQmf5TTp54=; b=Ecz1vft75YWK2EknbUMPHYDGEf k4rLRhh6+efuZEkhaFod3FIxtBcp1FOPLH+dP1kN1LMjOhfaumy9DxGEc1NDPFKfPgapkVjCDk6nP Ga/Dxf/Rc+SOPqaEqXTZeed39xc8dKGQ3BKZ3f2WS+CZwBoeuZOpHnQheWGwnKBH8WcxNjL46CtOP rKu0j3o0CxQ3LfhZn+tw73MDe0lW0Q/rkoSt2kXDnmxs9AVOBaBlTR5zVl8ZhY3LjfrrfL5nNaQtw cfzic4kMKLPjdXkzt0EedCTGxQAzEZV6uGS+jNongW5IrHkekKsPJ0Gzfj+Cv0+EYOWpVH69GJj8j driQXocg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSCsK-0000000HAfE-2WjC; Fri, 12 Jul 2024 09:47:36 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSCs2-0000000HAZU-2Lai for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 09:47:19 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42122ac2f38so10950625e9.1 for ; Fri, 12 Jul 2024 02:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720777636; x=1721382436; darn=lists.infradead.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=ud2L63m6lfr/M2Mr6IxkqT38hdjkayIOqwQmf5TTp54=; b=eGeqaSNlDDahE30qG3fnbeJbaSG24kLmPgjEr2X/Fhc8HZyt9XoT5At81kLq41bpdt seHRb49CobvriKyU93bzbdaRbq1gOUB1udQq7dvucJcMYH9kFX2+JwNbONZSOcHoCbBm am461xG+Zs52nFao5M4LmZSwP3SsHdI5fpCvbHWznCxDhGvAXbahKXcg4f+gLoOFMidu q2m+TqWixwEuPYj7floq6rtuT9ZkQuCf2KqxLvm8l9fBbChSurYK3O2Z0hX9+QS1aIwY TeieZagpe9OfOyQ8rbQgTcR/MXJEQpPIgwTBeN75xQ0Q6xIiIXgKnCzn3/pc7LEtCttH 7atA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720777636; x=1721382436; 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=ud2L63m6lfr/M2Mr6IxkqT38hdjkayIOqwQmf5TTp54=; b=o4oaDqc2+AgT95SZzNnQE7ZsReu0LhBdcdo7u+VQ4f3U9TbhONxSyMnpcE/69NrAWv CP2TM728t1po0zPlnPI0eyF5QW75dKxKpRMt2cgjsPtYES4t2a/7LIxlP66cTr5a/BBn 7+GOSAfMWvU/NbTvG3Ge9Z8PqicPZVbIWp32+KBoDZkL8LYVOLeIwz/ugjypsEN8QRQ3 7nUWHEezLTkgD5LOXg/uxcw5xdvcQymMRn+Veb9yHHWiMfqrV9HgmWadij5HMv7AQwQl 1dT+SrfISH0D2nL0fhUA3WJmMy4/LnfTYoQLGYNikbaZRrxhyhZ7j9qJUOrPDQh/Jamg DKMQ== X-Gm-Message-State: AOJu0Yx316BqMUF9/VWLYlhJFYFuV6iXwr8oQeUcudTCkkV5qd9z3+0r UqpZXTJ7maJKgncigaZdW/Op8VnnmvRerpv0oA7IHYDZcBmizn9XnBOCnw== X-Google-Smtp-Source: AGHT+IEPUFi5MlXgBv9LSjC/pr8ipgokcpefZ4i/vCVHWcpF6o8Q9FVgwFHOk8Xsbc1xLXl/ya6ZLw== X-Received: by 2002:a05:600c:3ba1:b0:426:618a:a092 with SMTP id 5b1f17b1804b1-4279da3a68dmr18451435e9.13.1720777636126; Fri, 12 Jul 2024 02:47:16 -0700 (PDT) Received: from ?IPV6:2a02:8389:41cf:e200:356c:31eb:bcaa:d0aa? (2a02-8389-41cf-e200-356c-31eb-bcaa-d0aa.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:356c:31eb:bcaa:d0aa]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4279f2cc42esm17722215e9.32.2024.07.12.02.47.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Jul 2024 02:47:15 -0700 (PDT) Message-ID: <2917e82b-eaf7-4db2-9c16-d164568df1bc@gmail.com> Date: Fri, 12 Jul 2024 11:47:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/1] arm: devtree: fix missing device_node cleanup To: Vincenzo Mezzela , linux@armlinux.org.uk, robh@kernel.org, rmk+kernel@armlinux.org.uk Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org References: <20240712094448.159784-1-vincenzo.mezzela@gmail.com> Content-Language: en-US, de-AT From: Javier Carrasco In-Reply-To: <20240712094448.159784-1-vincenzo.mezzela@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_024718_633785_E6E016EC X-CRM114-Status: GOOD ( 20.94 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 12/07/2024 11:44, Vincenzo Mezzela wrote: > Device node `cpus` is allocated but never released using `of_node_put`. > > This patch introduces the __free attribute for `cpus` device_node that > automatically handle the cleanup of the resource by adding a call to > `of_node_put` at the end of the current scope. This enhancement aims to > mitigate memory management issues associated with forgetting to release > the resources. > > Signed-off-by: Vincenzo Mezzela > --- > arch/arm/kernel/devtree.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c > index fdb74e64206a..223d66a5fff3 100644 > --- a/arch/arm/kernel/devtree.c > +++ b/arch/arm/kernel/devtree.c > @@ -70,14 +70,14 @@ void __init arm_dt_init_cpu_maps(void) > * contain a list of MPIDR[23:0] values where MPIDR[31:24] must > * read as 0. > */ > - struct device_node *cpu, *cpus; > int found_method = 0; > u32 i, j, cpuidx = 1; > u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0; > > u32 tmp_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID }; > bool bootcpu_valid = false; > - cpus = of_find_node_by_path("/cpus"); > + struct device_node *cpu; > + struct device_node *cpus __free(device_node) = of_find_node_by_path("/cpus"); > > if (!cpus) > return; Hello Vincenzo, If this is a fix, please provide the Fixes: tag as well as Cc: for stable if it applies. Best regards, Javier Carrasco