Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1017301lqm; Thu, 2 May 2024 02:45:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzPvKmiAgvMHp+zaTRrLlHo67JsVZP3nNZ9Tn50jIHGjJVZTHBpcK1jn39Oa6rjeoTj/Bic2hn840M4mCTV0eBVPXLDTwnGrd8vL4R2A== X-Google-Smtp-Source: AGHT+IGmy0rYIazhBQ5MC+mf8D4L2lTKBoh4uThbpHwC0U85Y5ctU/Ynx5NAp2k0EYvOzEBZz8lA X-Received: by 2002:ac8:5a8e:0:b0:43a:c024:b73c with SMTP id c14-20020ac85a8e000000b0043ac024b73cmr5774659qtc.52.1714643130233; Thu, 02 May 2024 02:45:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714643130; cv=pass; d=google.com; s=arc-20160816; b=kvVgtsCvWazBskJOqr5YFHi3uA/3wgVSsS82M/DJHSw/qeHImxsBZOTTCu2q7Eg0WU 0kqZsf2cj3X2MS8dczZQwVduIY9Zq3Px1ksMMMRJouDTmO6e1BiB6cHiUIfW9+s3MaHS rsxdVfh/g1VrrqoBYDPGGfOm542I8v8LLBFOWuc4vy6cReg7TaA3LpqGpM/+YId86Ig2 nGbKU5CVqJRhvSvnH//bSLeF6mSn10V2LGDonsiBMewEwdHzmHd+MtA7GvESwUA+5tX5 vOEH1HcjR7tr+ZZULqe/EPT5DqrU4jp5uNRTWwQ+nlDnOCuDelRcxFQqnKIADagObUhU 9irQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=BggNaQJ5GQ+jmFR5m3Y/yrh3MsWyNNVQDV3jNQjfMgc=; fh=09G+KBsBLg715VDcOvmQIvD4jkZGfQhOyeXJHmmAX+E=; b=YOJwqhwGmBh35Vh3qRmiwZfXFCQA5mO4Yo/PBGSOicqetN5lftpHmgqrBCg+60DC9i I3w/huPwuD+mab3TYJmfgDr5eHXgfQxh4Eg3/h3ZxyRR9y4N7BTH5MjBqxZiQ7/Z+a73 d6+xrE3oG5T/VwjI4UF1dVYl67AV0qq/kO2zEogjPxDVo4X+fx9nRJQ8+LSlwGxtpZeY hRJg6swEtgaR4BRdRgP8NyapxpY8F6rR7KPIcp2cxGKzx5HSPLDoU1ylqntO+wfRJnZg WgszKLLb2C6sge3X4HIlpY5Eb/mau7gN5ynHw+h1QkwoXiAI3KmZPXtJ196J8UAQA2Xu RKUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=oAfQwcFE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d14-20020a05622a15ce00b00432c2b07f73si558645qty.577.2024.05.02.02.45.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 02:45:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166246-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; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=oAfQwcFE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 EF0641C22817 for ; Thu, 2 May 2024 09:45:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D8515644E; Thu, 2 May 2024 09:45:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oAfQwcFE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 37B7355783; Thu, 2 May 2024 09:45:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714643120; cv=none; b=JmONAqOM+RmrQMLnu5V9vT6CZaWNXunjfR5TobAWdrmvMrgFKTyVJU6tipS8736IKVYlRVtuRegIwHpmYiR0sDiCs+IoyXOyGgcuGBEhMEDueMUDGINC2uDfYGZdU9fBdXdOrqfKkGRWX626c+/p3h10CCXcRS9KWWxjYRToi/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714643120; c=relaxed/simple; bh=KMKmbjNxDjaQW/0y4bty5ahkkoXZGQdtL8KqJYUhwyE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jye0JU9wZma8jHPfRlVCgkwzVu6n+DQpIxCY9sZDFapxY2O6jRUBoSSr1MbvX33rsWrxPV5dYCjw+Qb+Ya3lHsFLcRo3AhkW9g0w6h++bd4VEcLxeJn4TpIV4BCkgT1S7Cgp4OASuPm+0D5g311Urw6qX2rif6Ri0Qz3CVRAUB4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oAfQwcFE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC6A9C113CC; Thu, 2 May 2024 09:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714643119; bh=KMKmbjNxDjaQW/0y4bty5ahkkoXZGQdtL8KqJYUhwyE=; h=Date:Subject:List-Id:To:Cc:References:From:In-Reply-To:From; b=oAfQwcFEFQ4YSvMqY1Xbh/lsc5LPNSzumgD/oGqD14ngGgVPaEs7MibpgzzKx9oki Zagn8sEO8gj46WZhp4lLi4tBXFTB+pnYiA73nYZaFmp60rxFnqFwc6JU+DjWzL67dG /MZ0o36PB32nJVFZyZuANe63Rb2438n1oBk0vqlifHQrplthsktdyd/SJ9MqUjTqSh S4MhcJVVnSWRNuZQtI579Q7AgypadRVel2Bn/9DPwLpuM9kooXWaDgrnlLnFOcgFi9 WcmGesxwuIsoxe8I2o27QKIei0xaWcNAItuJ4mp51iYpDI3BxfZTFiHOR9LfE7YUv9 8qqWoV1TVGUXg== Message-ID: Date: Thu, 2 May 2024 18:45:09 +0900 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 12/21] pinctrl: k210: Use scope based of_node_put() cleanups To: "Peng Fan (OSS)" , Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan References: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> <20240501-pinctrl-cleanup-v1-12-797ceca46e5c@nxp.com> From: Damien Le Moal Content-Language: en-US Organization: Western Digital Research In-Reply-To: <20240501-pinctrl-cleanup-v1-12-797ceca46e5c@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/1/24 21:56, Peng Fan (OSS) wrote: > From: Peng Fan > > Use scope based of_node_put() cleanup to simplify code. > > Signed-off-by: Peng Fan > --- > drivers/pinctrl/pinctrl-k210.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c > index b6d1ed9ec9a3..2753e14c3e38 100644 > --- a/drivers/pinctrl/pinctrl-k210.c > +++ b/drivers/pinctrl/pinctrl-k210.c > @@ -849,7 +849,6 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, > unsigned int *num_maps) > { > unsigned int reserved_maps; > - struct device_node *np; > int ret; > > reserved_maps = 0; > @@ -861,13 +860,11 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, > if (ret < 0) > goto err; > > - for_each_available_child_of_node(np_config, np) { > + for_each_available_child_of_node_scoped(np_config, np) { > ret = k210_pinctrl_dt_subnode_to_map(pctldev, np, map, > &reserved_maps, num_maps); > - if (ret < 0) { > - of_node_put(np); Personally, I am really not a fan of things that hide code like that scoped thing... If I want a language that hides code, I would be doing C++ :) That said, I am not opposed to this so I will let Linus (Walleij) decide. Also, I think that "for_each_available_child_of_node" is a bad name... It really should be something like for_each_available_child_of_node_get() to make it clear that a of_node_put() is needed. > + if (ret < 0) > goto err; > - } > } > return 0; > > -- Damien Le Moal Western Digital Research