From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECA902BDC0E for ; Thu, 22 Jan 2026 13:32:30 +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=1769088753; cv=none; b=PGoLtYh2pE0uXJPbo1FGJZgsv2YcSr30MzfntKmYbPFCwdIyHk9pR0Xlt5pbCLAnsWAHZng4DeFtTeMiMIi01fozGZNlrMqKj7t8OlKAw7EiTSS2Ho9BYLyrgq2LOGS7GwFXR7y6j22TwOWMMMf5LVIQILPCHx1ElIIM6nJMb98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769088753; c=relaxed/simple; bh=ljFN/u7zSYor2bzwMKDUm/J9KCNVTPuqA8x6UfHUBEw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=M1bd0SL13oz03VIAFu1Bqg5DRx8/wzLohHd+MJHbL6Xo5n8G/2vGQepERTA0zv479jQoHsp52x7xcgMOH7YJBN3IIu0ywzksYiQaKNLOhh9dHUwSIIsXfzmct3o+fm6F7eR0f8yvLUYYXqdNizCf6UIslSnUUNvoF9NgpWtsGpY= 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 6F4AB1596 for ; Thu, 22 Jan 2026 05:32:20 -0800 (PST) Received: from [192.168.0.1] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C7C0F3F632 for ; Thu, 22 Jan 2026 05:32:26 -0800 (PST) Date: Thu, 22 Jan 2026 13:30:52 +0000 From: Liviu Dudau To: Felix Gu Cc: Sudeep Holla , Lorenzo Pieralisi , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bus: vexpress-config: Fix device node reference leak in probe Message-ID: References: <20260122-b4-vexpress-config-v1-1-3f0c85bc4730@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=utf-8 Content-Disposition: inline In-Reply-To: <20260122-b4-vexpress-config-v1-1-3f0c85bc4730@gmail.com> Hello, On Thu, Jan 22, 2026 at 08:33:04PM +0800, Felix Gu wrote: > In vexpress_syscfg_probe(), of_parse_phandle() is called inside a loop > but the returned device_node reference is never released. > Fix this by using the __free(device_node) cleanup handler to automatically > release the reference when the variable goes out of scope. > > Fixes: a5a38765ac79b ("bus: vexpress-config: simplify config bus probing") > Signed-off-by: Felix Gu > --- > drivers/bus/vexpress-config.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/bus/vexpress-config.c b/drivers/bus/vexpress-config.c > index 64ee920721ee..a1fa583e9f5d 100644 > --- a/drivers/bus/vexpress-config.c > +++ b/drivers/bus/vexpress-config.c > @@ -4,6 +4,7 @@ > * Copyright (C) 2014 ARM Limited > */ > > +#include Not sure this is needed. of.h includes cleanup.h, so we don't run the risk of not getting the cleanup macros defined. > #include > #include > #include > @@ -390,9 +391,8 @@ static int vexpress_syscfg_probe(struct platform_device *pdev) > } > > for_each_compatible_node(node, NULL, "arm,vexpress,config-bus") { > - struct device_node *bridge_np; > - > - bridge_np = of_parse_phandle(node, "arm,vexpress,config-bridge", 0); > + struct device_node *bridge_np __free(device_node) = > + of_parse_phandle(node, "arm,vexpress,config-bridge", 0); > if (bridge_np != pdev->dev.parent->of_node) > continue; > Otherwise, patch looks good to me. Thanks for the fix! Acked-by: Liviu Dudau Best regards, Liviu > > --- > base-commit: 053966c344dbd346e71305f530e91ea77916189f > change-id: 20260122-b4-vexpress-config-1d2051861d93 > > Best regards, > -- > Felix Gu >