From patchwork Mon Aug 12 13:34:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760723 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 39D2FC52D7D for ; Mon, 12 Aug 2024 14:45:42 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2vRtjY9RoJ4lkxTaWAaQzIhkuMec1ZzRbTb9Hn16sHA=; b=oW1nQs+v8b3gZyIIpqvBjnQyk/ eU3vW+gawYLl6aSvRFig/YfjLM4pz+iXw4jVb5bx4Tx4UFYjO5iAc+PK3jjgPNjFlN6d/30skKpRS k6ot+Vwy0bKzYLl44lr2+o6ADJDZ5sXvEuggeeUPIpFQgfWBcpc1ozROLYaFiZwD1JM6dOWndCgMC qVeh6gmaqyXqpsItDSGyY3ci2a8xZNNgLUHsVu99j881quFMroS2uPR9PEEGPlDIg6LJMFCJtEmzE 5wT1Bp4zL73fCbDHf+P828zPpuT+sPNfC23z8CAFQVsHloKyOiXZ8UbKZfnw3FjSzBkyiKMNplDm5 G0KLzkFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdWIW-00000000dD7-3Gal; Mon, 12 Aug 2024 14:45:24 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVC0-00000000R9F-34Yv for linux-arm-kernel@bombadil.infradead.org; Mon, 12 Aug 2024 13:34:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=2vRtjY9RoJ4lkxTaWAaQzIhkuMec1ZzRbTb9Hn16sHA=; b=K5miCY/v6xdYIV/G27fdAyUvvI 68htaPAVfh41MxVsnbtveu8DwqNxIfQa7TMLJDQwQLNW4kBJCP/FybKBK9D9yzIuOfjWC9sJHMJhq kuay4lmBcmQH6OiTjzpVhHlEiPbm6Tp179xuLFj6zOaeULtDTrp1T0rLnB7i1vK4B2PGMwHKjNVJJ 80x4dqh/Yg6tj98dj0xS7492CHgAyDhzMK5SOjAuN/1oqv7YJgmAtg7UUuWxwc94fCbtLbDEraXy0 O81eM1S+9yvOJR3czkEFYtSNrx4zaIqgrlu3h3trFZx2MG/gURMQyx6zGWZsyX1+CwjJPzGQHU1Q4 +mBxtM0g==; Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBw-00000007Za3-0vFl for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:34:34 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42817bee9e8so32732475e9.3 for ; Mon, 12 Aug 2024 06:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469669; x=1724074469; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2vRtjY9RoJ4lkxTaWAaQzIhkuMec1ZzRbTb9Hn16sHA=; b=YJUA+/jnynpeiUz9nGPd9zMArHjo16FMBFdwvRGLLYdkCSxJr2HdwtKjBxcEAf5WSa qMZS7coNQo2TKdptmvi6ybjZIMw4QoPdefSBpaOTBPB8LMbNngRFObPFbIYALNH+fhvw fDuxzMVCop/WpT2Zy+Pu6iehI8euSgbZ3w6ZPOR/K/gCp6EysjutCIbA3wt5HsZE2qit J94j0RAjBmXhM2ijepn973BuqxSPvWtHTJcHh0fWCpv0O+Hqk8cpJlmeHVB+LrHjTdEZ D15mg49dB5l1gKHq0kofY3M6MZbfGwgVp02XtrCy4To4scoy0LY1GFrXPEbUk8cPWKk9 Ajeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469669; x=1724074469; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2vRtjY9RoJ4lkxTaWAaQzIhkuMec1ZzRbTb9Hn16sHA=; b=LR8zx2thkxTmz5Vq8KBeuB9EAQxvFvE/6bTIBqFZDKA6whDa3nvH7JS9u4SP1L/D9q c3T+KF++tFUP3QBdvUYx4C5xqsnM7jjzzehfhW6gDJy5nvm0TgTaCfa2fyvlE5ZTG159 IFw8Abc/tBE9R2DGtF3Ao+6SvBAzPirkp4cKiKwscSCbLtst69Rkj3HTdG/ZuH4Mlr8y HSui1oQl5vkx09XPdxJPONaMGKQMUADZeOYwvEuBhzRi9P1RxCD3ovucoKAqK9bFk0H6 wnZnsZl4vYJAfQ3p3HcPsMFm8zV4cnQtGnD3fhGK/6eawtQneSUkc9LdvfpP+26TzO/i bKeQ== X-Forwarded-Encrypted: i=1; AJvYcCW75gOPpKwlse309b+FM1EM6hUZxbXvcWq28pSRuyhtXmFVRkO6WkKfTOt/VLLYOGl76/igkinVze8NgbaqgZQkegLfPyNSQePtRtK8QJtwrFz06Wk= X-Gm-Message-State: AOJu0Yx9fmXK/Zb5N4Qj1M22A6NRRYFMdmGn6gXxNOrSjioeN9Q0iUgS ll0DCd0NocPYtc8L56rUyQa72feu2kTy62mNmvkXf6lEVVaKYS2VbUD4Gw5oMA8= X-Google-Smtp-Source: AGHT+IEEUwAlG76HjxJAsyK8S8T/mYq4aEjAVVfNn3IzdOaUbHmzoELCalL3YkqLxnDddPuKFudeRg== X-Received: by 2002:a05:600c:138b:b0:428:10ec:e5ca with SMTP id 5b1f17b1804b1-429d4801e5dmr2984845e9.14.1723469668894; Mon, 12 Aug 2024 06:34:28 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:28 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:34:00 +0200 Subject: [PATCH 6/9] memory: tegra124-emc: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-6-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1246; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=IlxS+D8E+Bo6nHEepn+0mTB7t42TrSmGndFVSzcMSuk=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9WY865X4GH2lunkVHCyM14mLujFcZgf8J78 qI8SrlTVxaJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVgAKCRDBN2bmhouD 10aeD/41meg3/8L8q4GOxl5Jxe+3hlN0PEmllVJ2SQY0syA/bR9hZ5HnHZrvd8TUzKepy5Pr/iy SDdFyfaLYElBSZYUrpBIJ0eSCjbPuaUaT3FfClCW3EVZXO+OxFPD/NC6IY1HJyaiegFT0SWc68G z7Qa0sL2FuqN0bItr5eRrGgOAN+nscmxIw4WqKd7VgPoDTN44IskG7JMI/CPEnJuGPhY5xqzCfr iYjP38QLXnQz1Qh9LZdeRg8hS+5HkEwTaqNoBE0kd3JiYjkxdR/5GUQEWeit8zufS8B1DM4/Rc6 hQSZm6PkJDv9n5P9hLBD+ufLVQKJdYdfJVEC8iraYg/e06vlLB/elPsn/+qb/yM6alFuOb8AfDd Fi4yVboCoRyJuvc+V7wKvfz/TcqI2iqSmJNaJmzxtFeNxbsIp7lPMD8LyxYy3l3xQXW5DHKaRvA z6JJ4JSxAbNYluLpGBJZCTHl+fIUhU3S0CgxZH5GNnIgvq4Rf6HgIZIL4zky6HtPopfmW9TQAvH M6qgaLDwO8DwsDv5Bw1IF3VS0SxwBLiWxLQV1iVKRJiXcpLhDUReB4QFLv1X7ycVnOaouhNPrdb eavRIJkAtuQb6YhgpqUazX1eq/fCPLnT/sCa0s59ys02ye5w9qbbg0GqzWnGenksh6pnzHYOsX7 fBP6UmhbugpR3vw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240812_143432_432681_B3958826 X-CRM114-Status: GOOD ( 12.82 ) 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 Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/tegra/tegra124-emc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c index 47c0c19e13fd..03f1daa2d132 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c @@ -992,7 +992,6 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc, struct device_node *node) { int child_count = of_get_child_count(node); - struct device_node *child; struct emc_timing *timing; unsigned int i = 0; int err; @@ -1004,14 +1003,12 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc, emc->num_timings = child_count; - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { timing = &emc->timings[i++]; err = load_one_timing_from_dt(emc, timing, child); - if (err) { - of_node_put(child); + if (err) return err; - } } sort(emc->timings, emc->num_timings, sizeof(*timing), cmp_timings,