From patchwork Mon Aug 12 13:33:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760722 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 8A950C52D7C for ; Mon, 12 Aug 2024 14:45:35 +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=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=VcjWHdiosHcY+6S2D0O17zgqYs HrARpLlwVCh1xle8YISDYT0s+kiGR5EC6u+viLCLDyPP6Sypxbz7HKKF7Z+MX+mbh5ZLOjQuuYyWg +XvhufMFAQ4iQQWWELdqDznSOBEVped+fJnMWXby7mOAmjlZauNh/wjKPJvYhWB+OW46g7QZOFRlz lP4uanxBcgsKAl4uBYreKAUNXUVt5KpOKuTxpXLZNXPIElLNtT0MxqUsQ+C5r6id2IaB1vJrXNiZ1 lHtsZQFqz5CAJNy8KS9tZKuJeaYCuQyh8o3wbYtWwVG0Jb3qrE5KRWnTSfhvsPlCYvCsMLrX0mvXb zGZvX8ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdWIW-00000000dCy-0obH; 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 1sdVBt-00000000R7Q-2Yjw for linux-arm-kernel@bombadil.infradead.org; Mon, 12 Aug 2024 13:34:29 +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=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=bbrcx/BiY7bC2Z6/9Y1B/ajoR4 jREZoCgR1Aj+vI75l7IXOdHCRhQ8YWR9DGfIASuRVmAUrCo018k8XL+YVnDLztMBwhpBGdD4Ug4uS Qvw8SQTc8oxdRp8KHdm4N2dlp/QIqWA6GHne7nJL4sjc3Y6i8TNT+R8MUP4JKsdqcJOcCPC1whizQ 42cjMviHx6aeQKgVsew2XBWvrBxrp4TNCmp5ZojTLiWN8jF1Ujk4gFtXaZH4oX8V4iiH1FVg0RUzf i30g1ClHyWE9X07Hki57UVL8i6teH1trLND7SbpoUtY8ew+xA/9xq9/+uYFDLkoq4RapZ1D2NqeFO YDYxJPbw==; Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBp-00000007ZYp-2WVu for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:34:27 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2ef1c12ae23so44059761fa.0 for ; Mon, 12 Aug 2024 06:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469661; x=1724074461; 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=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=NS2ft2YAcSDCwUAbTtmtgqphux3fbx73lEPBb8ft/BIngFL6HP5n4tiFbx7X3KVEtU Hp3oQIA9+dbVz1yv2vzPKdSHtVnqAyMUyEL6ZI7JHgLfI5JlMffmxlfFtpfS6u2UIZHQ cAz6umY4wYnxpDQz1CSQtROefJ+V5EqzfFccnD+dAibcXuKLdxEn7+9Ot9Nrs8JOicUM ZIEbqkGdEyMrPLs4cgOunmckqZZJAKk4CwFVYhNrbTZ0sR9zJ/0flR0xRLyirDp8imoQ TCB21epabRsJPknzO+5/CLNIg1w/UBD48km55xV2uyatBW4NwKUGgFRNQdAZzVTdUf2k Wcwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469661; x=1724074461; 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=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=skmGoqc7Py2Faq6X5PELg8e2uEO5heAoMOUmDGhJALyXiLRC9GtXR5sdIWA55f4sIN ykNRCWFiTng07XzHnBxoCjIfMwLFjcq1snzHs+n1LxuYMSYrsNrW+XVl2U4UQlgQUBmr 3Lb4GJiCXZERFSQ7jmRD6HnCCX42djwWR8+3p64QnyVQSm2QYjN8Lg8Hx/ofPcZ/1Nti wH6QmTIVU9CjsLd4nMy06E5Kmxe7jTNxjxoWdC/QkEO3c9f0+Iz6o7QmSK/WMR55QG5g ge/FCk8P25c7KVv+Iq8Qz65ibnM4liIcrmFtw5E78Wn+3LdUyxK/WGhJGPKpvxtKP6sp MMnA== X-Forwarded-Encrypted: i=1; AJvYcCVwE59q6ArJyHYQFIJxxXXFVQ8RJab+PbZQWg8Sj8goAfp7OLleUyarb9daMkLQ9qLuO/6XC5QJAy3NOk0eS4kInQOh0TP1m2hqBc7drMWTMZnOhEs= X-Gm-Message-State: AOJu0YxEP/wTaj4thO9owV17GvD3X1mtWtxPr0S2XhmCj2aUIAAc7oHd 3WH+N4IqtSMZQBJW+KWfQ+V2we8GZIkdlUqlbs2DBhj4bJhgzdUpBA5aKcDCAxc= X-Google-Smtp-Source: AGHT+IHQihxBmTwZO+gpopSrog1h4Zwo6nfMe5CMTYHEB+GBFOYD57QnlF7TYHYQZ5mGOjHQLKtWjw== X-Received: by 2002:a2e:9985:0:b0:2f2:9c23:3412 with SMTP id 38308e7fff4ca-2f2b7156ee5mr2174791fa.23.1723469660887; Mon, 12 Aug 2024 06:34:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:20 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:55 +0200 Subject: [PATCH 1/9] memory: atmel-ebi: use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-1-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=2456; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=xgfyKZmDDIbZTBcHgkC4HQRuoKCVphYVJo2Oqeoz2yg=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9RWiZUzjyUB45cY5GRGscQmhk2n/JWQ8eCU OV6qDjUvVSJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPUQAKCRDBN2bmhouD 1xyXD/4zIloc9i56JR/7avOvWMonHwPMgxrw6eW1Ql3uMGbouCHddr07MRZROHf7FHGtaDBNSzW mxhzYldkGPh7W1K5fj9UFeZ2zvkfrn+rQdUhG83d4r5ihSPYCQzBxKNTUvwKDDrn2jZ/DWAjmfh TxjAUuNnwbSkd43KLCkjRjmKHg1bCsuc/NromW6Jla20roeAfx6ousA8KIh8deLOJvUSd9IjoTP vhWCOrq414zR2AtAX4vd2IsPJM2zqwKIUt/ZXVvpV6IA6I5emax215uBPI/tq0XEaLTbW5dH/v8 JpZBGwkHxrkWhFaXEUS01fvJMEE2G+rqeMxi9GJGQSITpOae42sKZXL7jCxwsDsQ5zgfRwWGvJ5 veNYQdH4lAPRjl8MUL3h1K42k3GfVx4S1i+6PqIyC7vk7MOfuUV2WBitHAcxMyjcQMbj8XsjyvB iMMGFF8VDH2oE6eJ4aaUv+Co83vS2sYyoIH7BWNGxvSW2ajjcesSADyFhNMcoelmhpGZTckxESl 82l1O1qvrtFb0986Is0vJ6OhgHDX/Eja/dCxlk9T+SvRzZha67Ecrv1oWVyttwKxwqIrlMjdM0L b7iludiktLPGaXEtTrzpL2Xl3GZiWkzR9es+685yu7ltUGzpJVSzqu8GN4yqwd4riFxIzLgCaj2 TMtGaSenJiohE3g== 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_143425_868088_31C6ED49 X-CRM114-Status: GOOD ( 15.48 ) 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 Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/memory/atmel-ebi.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index e8bb5f37f5cb..fcbfc2655d8d 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -6,6 +6,7 @@ * Copyright (C) 2013 Jean-Jacques Hiblot */ +#include #include #include #include @@ -517,7 +518,7 @@ static int atmel_ebi_dev_disable(struct atmel_ebi *ebi, struct device_node *np) static int atmel_ebi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *child, *np = dev->of_node, *smc_np; + struct device_node *child, *np = dev->of_node; struct atmel_ebi *ebi; int ret, reg_cells; struct clk *clk; @@ -541,30 +542,24 @@ static int atmel_ebi_probe(struct platform_device *pdev) ebi->clk = clk; - smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0); + struct device_node *smc_np __free(device_node) = of_parse_phandle(dev->of_node, + "atmel,smc", 0); ebi->smc.regmap = syscon_node_to_regmap(smc_np); - if (IS_ERR(ebi->smc.regmap)) { - ret = PTR_ERR(ebi->smc.regmap); - goto put_node; - } + if (IS_ERR(ebi->smc.regmap)) + return PTR_ERR(ebi->smc.regmap); ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np); - if (IS_ERR(ebi->smc.layout)) { - ret = PTR_ERR(ebi->smc.layout); - goto put_node; - } + if (IS_ERR(ebi->smc.layout)) + return PTR_ERR(ebi->smc.layout); ebi->smc.clk = of_clk_get(smc_np, 0); if (IS_ERR(ebi->smc.clk)) { - if (PTR_ERR(ebi->smc.clk) != -ENOENT) { - ret = PTR_ERR(ebi->smc.clk); - goto put_node; - } + if (PTR_ERR(ebi->smc.clk) != -ENOENT) + return PTR_ERR(ebi->smc.clk); ebi->smc.clk = NULL; } - of_node_put(smc_np); ret = clk_prepare_enable(ebi->smc.clk); if (ret) return ret; @@ -615,10 +610,6 @@ static int atmel_ebi_probe(struct platform_device *pdev) } return of_platform_populate(np, NULL, NULL, dev); - -put_node: - of_node_put(smc_np); - return ret; } static __maybe_unused int atmel_ebi_resume(struct device *dev) From patchwork Mon Aug 12 13:33:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760598 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 79E75C3DA7F for ; Mon, 12 Aug 2024 13:35:52 +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=lgTXsPloyXfID4jwvyIhu24dRWJVHUfhWh9HifazGOU=; b=f75v4C6UitsHhqiiUKc7oIIR3k L+z/Lr/xbBYF9K809wx6QtTYxeH3TfD2VqEVuxW93i2o000bqHzccYfeIEMl+sMkIWp6gxvYpAsCB Jc4TCTTrMlRhKFMUW6bDIB2NcPaeoreHQkXb98yFHMlQW+XWx8JDcgAc6U37I4azcpcof4Sp9tRkx av6p+1lqpWuhLJt6JDY21zKHisbSq8ok/59YaFS6yWJPaM9F0UHRiOBlSgAME6I83drH/XON8p1bi DE5pH/HBw2ZD5XxrPF5gelnTrxwyJG9Hdn5dIxBBBU947uea+xMMlcOvuqS7R6CpMHWJ9NQw2mkCy YlYS51HA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVD2-00000000RM3-381l; Mon, 12 Aug 2024 13:35:40 +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 1sdVBt-00000000R7R-2zX3 for linux-arm-kernel@bombadil.infradead.org; Mon, 12 Aug 2024 13:34:29 +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=lgTXsPloyXfID4jwvyIhu24dRWJVHUfhWh9HifazGOU=; b=WhVSoWOApQcOABtTM3mkCZDClu lQQtv5zhbRa2XbN/n2nqevobzVsStik9p940f5+/a6C9KwtdveHqkpFtSu0LEWa0veIV+CjDUpwtD SZYoV0qpr2QJmUT2Bz+iq0509ZRVxdcaPoa6caV22ZAxL6fIlZS7/N5GMfDpbMbpvTYf0mngpnxd7 y44BxkBiL8HAyaA3dwcjN9qYnSPwFQ9yPfjSzCFVytP21pIjx4kkAnPamkhHQ48rVOE2tBGerbuXG 1uJiLjxOyVnCM9+6o4CYgJbBlVt18VzwSQ0S73dBXotvAQM7sKrqd3k+g2hBqJq23JtGMvn7WlDhK KfS0Yaow==; Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBp-00000007ZYr-3n8z for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:34:27 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4280ca0791bso32318655e9.1 for ; Mon, 12 Aug 2024 06:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469662; x=1724074462; 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=lgTXsPloyXfID4jwvyIhu24dRWJVHUfhWh9HifazGOU=; b=CvReShf91DW21JyfUon8fq76LEDKTGzQnz8qTG+CRtATzHlc2bNKJhXmw4MCUqUADA 7uIeHzZ0Zagxk+0p4XA3zq/cfXFuC9iUytdMidQambDWiopE02Z+tC+D8uSQLkeR/TeP S4nOrQOJpXwoTBkdtHXlJ1CNxWlEMTP66YmR2dvPR7nGZ7JwyIzTBAP7HGUz4S4+3fmX axfkN9QEmng5qNo1I1rpg1kvnWH2yOA5IdCOTLkJmYiQ1i926MBjpn79Ns4LX332Mxeu r2NDR7b2YiBZCCx7xn4RXLCmuUz2OA/VlCdoBqqsD10fQ/+Zd8k+MQl6cFzTklaw+0DZ bHvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469662; x=1724074462; 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=lgTXsPloyXfID4jwvyIhu24dRWJVHUfhWh9HifazGOU=; b=tyx1idiB+INS24NH9Z0GbkBN2SHz2rTlZ/HxpgxXHxhpL7J75hp1RnikAnENumyX4t x++d3HN0k5nas36zgosTUIUgALPJQ2sErumIEvV9UWi1NzQQb688jyzW6g6Fb+/vFdov Z5cv6Ocl4b3n7lSK1U7qHH5H0La0Qy+jIix+DECbMOjBi8Lgw/aN3rmrl5LZJDfKumFO 4CTcRZYQeC+8radagzKjlzm/klK56zrW8pE3kfHXvXRwqPgYNwqljM4OjeWSWhsdX5Ff te3PKlwEo3Ljeb1sSYt1nOgVmG405WwivJM/ldHiNEcWoEbgf2nX1kGxP/LFJ8lzOpVs obnw== X-Forwarded-Encrypted: i=1; AJvYcCXUaI5Egh/sPmBm+AsHBAMtExSxbMQrMBV2DUUMG/Ypp36h5Cgf09vctTQn3cG8qijhJ/7/zpZE80NB50tWUI9D4W//TzsGq1t7SXHyjCxxsVIGk7s= X-Gm-Message-State: AOJu0Yxir4qAu0ifqdnWD1m248dk70kHYP7kvWvOH5xHZojEUI8mToQu Y2PoelCdJS78wriqIr0gtXXit5gUuHJbdp29OETBquFfKVO5le+JNHnl/qsC1cw= X-Google-Smtp-Source: AGHT+IG2U+2ivgdNzf99p2ylaUjGb2UicWlTptEg4n0FqVE6AqYOjcDIhqYbh/ow3uzGl5LVUnouOg== X-Received: by 2002:a05:600c:154d:b0:426:602d:a246 with SMTP id 5b1f17b1804b1-429d48976c4mr3808995e9.32.1723469662493; Mon, 12 Aug 2024 06:34:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:21 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:56 +0200 Subject: [PATCH 2/9] memory: atmel-ebi: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-2-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=1350; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=gmw7sdXN++0ul8rDzvdEpJ8YQFeG56dlD4XcPKrvG+o=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9SBLK2/VucpJF/zx5ZBYvmfrRBNn21ar0oB 3a/Cv0noJqJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPUgAKCRDBN2bmhouD 1+yYD/4qcA8Bj3tzEWx6jyRjX8fDvf+bTdrauIEu4tdm0NhBSOPEGsMhDXH6CgHSvmu29T1Kvz4 ZwZ+2AAdDjZmdWXiU9FiAnN0Q33OjNkDRlCR8sEXjyPyOmXnjgzL40SEALgNKIZi4bpTvB8XX2L X1RJgqy8kocB79a8itpXzdUz9K6D9nHmPXj31YzY8qhiq3bGZrMX0UayHyFFwZXzC4+MvpXbxpE 0IGsNG3fZTX84XsBX8bMvnV/Dz6Qh52B2e5+3gd9szOpKHYQjmw8sqJO+VzdNJ8WexnOV1SJE7I qd4gUgPlThSU/cCUNWlsl0UmvrA2ksWUVvqU0BKHOj/SEmh6VCnJ0sCtEB9v3sjVC0uH/KDQedm 1gwdxLTsFJugS6pDjZd3lpOH26QeWPz35qwz2kWyoFTFFhMDtygj7NtFrX/rXbXI2P/ykR8PKo5 TYETYdEEHdUE+q6d8/kWbMERlzyuEcyKeCTWOndMO1tmQOyoV2g2JgD4a1ubtmwr/LSLRU4YldQ mAqYO/LNC3hE9xUwtG4Zyb+KI3NZLLfTdEOYgTIIA6HLUEPlN3wrmq/7UsP+t1+DPndJVaruZn0 t50YYT/Qalyd0LGdIKkExmcImtEVJs7HbFZn784DibyT6IaArLfY99yM9caNxxgpedYMxOdsMT9 lDEND5PW7HyCZAw== 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_143426_126814_1BE1FA03 X-CRM114-Status: GOOD ( 14.42 ) 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_available_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/atmel-ebi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index fcbfc2655d8d..abc6c067b5f1 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -518,7 +518,7 @@ static int atmel_ebi_dev_disable(struct atmel_ebi *ebi, struct device_node *np) static int atmel_ebi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *child, *np = dev->of_node; + struct device_node *np = dev->of_node; struct atmel_ebi *ebi; int ret, reg_cells; struct clk *clk; @@ -592,7 +592,7 @@ static int atmel_ebi_probe(struct platform_device *pdev) reg_cells += val; - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { if (!of_property_present(child, "reg")) continue; @@ -602,10 +602,8 @@ static int atmel_ebi_probe(struct platform_device *pdev) child); ret = atmel_ebi_dev_disable(ebi, child); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } } From patchwork Mon Aug 12 13:33:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760599 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 A4CB4C3DA7F for ; Mon, 12 Aug 2024 13:36:30 +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=SQA/PjjohkpV6TqZg91y0zhylBtn0W2KyopE+/TT64c=; b=cO3F+/KGpmyHGC+7qqqBHieIxZ 1fXeg1LLDNrqQof7t60uX4HimLnDGHyEH7jG6O0MfDVsujTP+CNHmiVFuzU039+GR6/lVFnLWLwKb 4ZAyBM7roEEyUayK+3O8eGaQ5BB4Bd/u0HpGnmDaATUX3KdDGzq61jYiZ0oEZM2e0CG8IOLUFigXu BusBuVquNC6Wb9ieAcSuMA2dAgPNg1ONIpf12xoEsd+KXmJfq5NHyM7613pv+nrHPaUOO6+ixxDvO EcLkY5nQH85OxCjKmR7biddIR7thC3WDnXqANsPFzzmSsXQuyrTCOWJdBwKnycm/YxCjP1I5kzz6d QrUtAooQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVDc-00000000RSq-15WW; Mon, 12 Aug 2024 13:36:16 +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 1sdVBw-00000000R88-1q3G for linux-arm-kernel@bombadil.infradead.org; Mon, 12 Aug 2024 13:34:32 +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=SQA/PjjohkpV6TqZg91y0zhylBtn0W2KyopE+/TT64c=; b=Tg3NLm2aenRjrd0cmlmVcn7+qU pCYTmddOs8LObVWCK0CUtmOH3S3ktxi4DGapmgd1disP2Db/pUpIGudklgLCZ2EexuPifTGS0jY1t jMmDYvX8k8dt6b1UgDk3Md9P+31J7TwgSLdSwc+BHhW40lc/WtiCdhuBCbPKEb7AmM1QvuqW5LSl/ 86yOi6oB+CzhwBdevh/TaS0LdgvOZSc94h8XcH83isFmbmhRIDBQZQU8UJA2gFaaOlqCFmlxGCviX 5rol463NGlOBHztaZQy7EWyjY43ot0Vthd5goOgi+0dtTRlgeE2+pSm0hd7hOG1RVt95i4FXyAANm DHx2d88A==; Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBs-00000007ZZ8-1nUC for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:34:30 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2f16767830dso43571971fa.0 for ; Mon, 12 Aug 2024 06:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469665; x=1724074465; 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=SQA/PjjohkpV6TqZg91y0zhylBtn0W2KyopE+/TT64c=; b=jRXP/qQdRVAO+2XqFNUZUkCAGXLuqbC3Yf84za9QgJVoe6tp0M+uTJGRDgbHJpmcrH UVqctQOfoBYP6iJUm+ZTSYgYEDDmqKeWm66QPZ8qba5u7qrz2q94HVD1YV5zj987y8XZ /qHNhOJbcuhwmsFIuXaIcUKG0VYT/QZIAI0KXOLtUjE8RHUVgTDWHUMIsdw197mYNwLI zmcL2nte79pLkg3VqFNlgKxf50jXolmvOHNSrm81HNlPp0d+kZ/XVpapf5C1v3KrVfYx mnvvQEcQtzf2Z36i3jQrMZQkNPzkaeEkNJOZfkoRABAR4io499Xxiv4OuqhIIXWZ1f0F b2WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469665; x=1724074465; 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=SQA/PjjohkpV6TqZg91y0zhylBtn0W2KyopE+/TT64c=; b=O+RqgfCYVqwbnRB4eWBp1uvo182jBj2EQOI3uV5MYdTztnlRprcm9LFkGcTvygJU9h rzTcGGgt4OuYcJVAOkuaTl+eJlr7zOefX75U7PQuO0XTyYmFJx5WcvhPWZ6rn0c6SxXY cJ+nPX2vMP0rkunBFNFApsK4Q0O5c/zyU448G95dJ91D88Qk1xTHeP8+0UAX3RNg4Dzs FzMOIP4N4UquHLFdThmrq8pItOuG7b81f3ePMTJ3ubqfPMRIvPtDQm0A54XH3RBmoMMI A0hp7UR1CPauIKdoI89KHA0h5XVeR8rS8FvIve7Pt5t7pN+PiyL2lUeBxjc45mNDGKUv fREQ== X-Forwarded-Encrypted: i=1; AJvYcCUYMdGT0JeuskWV2SWdizCapUVvoPjUAApglV7MpJB0yC5bv8VjYnJNxC0D5w4TV8bpyWpmqw7IyRcJczHYymjXVRNOuc4wGeYkmr/TpUdmzu+ovGw= X-Gm-Message-State: AOJu0YzowO2Ge4MyID8ZpIECwlTBH5RuCDYufynwlAqDFdC5FHDtWo5B cingpgWCoN/NQ0yOvgND/UadzYee61OzLHX0KL28iuYy/z+zIa8ukdpFAzMFhzw= X-Google-Smtp-Source: AGHT+IFuG2qd+DzlKsP6QmlNw7cGw4vQwIOF5kCUyHlkAobIrwVs2DCtPwAfbJ5IawKIByi9iNKEWA== X-Received: by 2002:a2e:d11:0:b0:2f1:9248:c325 with SMTP id 38308e7fff4ca-2f2b717bb9dmr2097961fa.31.1723469664458; Mon, 12 Aug 2024 06:34:24 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:23 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:57 +0200 Subject: [PATCH 3/9] memory: samsung: exynos5422-dmc: use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-3-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=2782; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=ZuL1arzThZP1bH0X88EKns0i/Pwsb1RnCMJkbCddCK8=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9THrzP+A1BH/yeTSMDTHI9G2M6wGjffRCSn dlrxuuifPyJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPUwAKCRDBN2bmhouD 188OEACJwoc0GJ4OOrq04S9Eqnai7E1TmoY+QS6g/X4/oh4fUgYz6R5MGupwE7ya/svO86v4gOl OLe8SdJZKjvqK76134ROWFAUJfVnt+x5RIg6hxI7LsqUOCxd4+P35lymy4T1T6M1Wm1YD+bzZcT b+hJuth2lbekjBDszhBlcuwsLCR+eP4qOP4X60dIIz/DTwLKRIsNKi1ZzceLBcnU3FxO29VYJo7 gPDrthDsbabgcU/p+jDKZpqlwyVbYPGmOwXrB+qA/6UpNUkSgS3rEBGULDktmxaOWiCVYAf/uxU hnIEBvoqeT7dGdF/zxzP4IXa33L8dQ3nEhTktFn/KUFO7KSP0npI9YqxGe2wTq4U1Iu5Vv280pp ebL96l+uGfl7yGN0vm3XsrETWTo9jkdwTEC6nNhFbXQbMeZfppqiXSnheVM6pyTepzKzcHhmXOo 0BysbLIOGMoxpcppLMfsoaimruRVTEn8PloUDzWjtD16zDFGKzngIrJuXFP0QKUiK7nLK+tFGiT kt4gMkJiRZCBIxDLPT2HkMhtyfSZMcKX/sIsKruL/TqdZ2oD4zY3RiNFWtZ9NDMNRI2wQP/yB6X Jbg4bT8+JbyRvvxHwF0/F4UaF2Wz9fGUB/XnfSw5mFRgs6GJP2sFYXsymEwhYpm/d8s6rmdQ643 NIuOrNP6Z8e6AGA== 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_143428_787561_1D0D7243 X-CRM114-Status: GOOD ( 14.67 ) 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 Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/samsung/exynos5422-dmc.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c index da7ecd921c72..d3ae4d95a3ba 100644 --- a/drivers/memory/samsung/exynos5422-dmc.c +++ b/drivers/memory/samsung/exynos5422-dmc.c @@ -4,6 +4,7 @@ * Author: Lukasz Luba */ +#include #include #include #include @@ -1176,10 +1177,10 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) { int ret = 0; int idx; - struct device_node *np_ddr; u32 freq_mhz, clk_period_ps; - np_ddr = of_parse_phandle(dmc->dev->of_node, "device-handle", 0); + struct device_node *np_ddr __free(device_node) = of_parse_phandle(dmc->dev->of_node, + "device-handle", 0); if (!np_ddr) { dev_warn(dmc->dev, "could not find 'device-handle' in DT\n"); return -EINVAL; @@ -1187,39 +1188,31 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) dmc->timing_row = devm_kmalloc_array(dmc->dev, TIMING_COUNT, sizeof(u32), GFP_KERNEL); - if (!dmc->timing_row) { - ret = -ENOMEM; - goto put_node; - } + if (!dmc->timing_row) + return -ENOMEM; dmc->timing_data = devm_kmalloc_array(dmc->dev, TIMING_COUNT, sizeof(u32), GFP_KERNEL); - if (!dmc->timing_data) { - ret = -ENOMEM; - goto put_node; - } + if (!dmc->timing_data) + return -ENOMEM; dmc->timing_power = devm_kmalloc_array(dmc->dev, TIMING_COUNT, sizeof(u32), GFP_KERNEL); - if (!dmc->timing_power) { - ret = -ENOMEM; - goto put_node; - } + if (!dmc->timing_power) + return -ENOMEM; dmc->timings = of_lpddr3_get_ddr_timings(np_ddr, dmc->dev, DDR_TYPE_LPDDR3, &dmc->timings_arr_size); if (!dmc->timings) { dev_warn(dmc->dev, "could not get timings from DT\n"); - ret = -EINVAL; - goto put_node; + return -EINVAL; } dmc->min_tck = of_lpddr3_get_min_tck(np_ddr, dmc->dev); if (!dmc->min_tck) { dev_warn(dmc->dev, "could not get tck from DT\n"); - ret = -EINVAL; - goto put_node; + return -EINVAL; } /* Sorted array of OPPs with frequency ascending */ @@ -1239,8 +1232,6 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) dmc->bypass_timing_data = dmc->timing_data[idx - 1]; dmc->bypass_timing_power = dmc->timing_power[idx - 1]; -put_node: - of_node_put(np_ddr); return ret; } From patchwork Mon Aug 12 13:33:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760604 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 A151EC52D7C for ; Mon, 12 Aug 2024 13:40:24 +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=CxelJ2EbVi7FPWoh5bPyWxBtOLrcrZXgDmweNSFWgLY=; b=i8Z3Ae+6Cu79Z7LBLPjIc/cW0f RD86MfX7lmZKj2AZHM2yJXRJeRZ6Y4TqrRcDHTaA1jgEaJPHLrKmMXSZyu4MNY8L0cOZYQICvg54D uECrrRpgPDqPRQpeNNufo0n1siCB0VL8wX2jRjIVHEwplySrLBpi2oRYkpxBKNHxYevIZreg67Ltv fy0hmA+PpQtxDH6S9LuwlEPbVCCoZaF58Ic6/Oui0Ia19Z1UUXFDcDe00lywmdKzxBjCEVC51HIdJ xT5R5xCnxVaAnnfvtjLoHvIuYi9o5bWR7nGBj6s4iGkNYhYsqRB2JRDECTrN23ixWLXPbTrxPilg/ c/BbTwBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVHU-00000000S5R-1DUv; Mon, 12 Aug 2024 13:40:16 +0000 Received: from mail-wm1-f53.google.com ([209.85.128.53]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBs-00000000R6N-23py for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:35:02 +0000 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-429cfd469cbso11919615e9.2 for ; Mon, 12 Aug 2024 06:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469666; x=1724074466; 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=CxelJ2EbVi7FPWoh5bPyWxBtOLrcrZXgDmweNSFWgLY=; b=BP80MIquMYGu3xXd6h2THgpHMwOd5bBzsCDQaCo6bb4/dbgPT4a27E9y3wy1sSHA4r HCvKnai1uLtqW0xvtB7uL5tkd6+QH/k27gdsoFDZZ60XEc8mYCMcYT5sXbRJyiGRmDIn ntI4HguDJWz2XLJrQ+FO9dzJO1v8y6JQ3GEk4Gspf3rm/9c49m3Z0NaMoi/oYjjhYDKS wykNW/xDF7R0qtt4QPCNRtKVsxTx7OiDlMO8cctdoaazp+wqjRW17amTYN0oaM4wjSsB eJKoDWaAruWo1IwDBDXQTskRjPQWIqyDqOzvNyDCzX+vO+m7ckKGlfA0ZFtS9SAmQi6N H5zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469666; x=1724074466; 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=CxelJ2EbVi7FPWoh5bPyWxBtOLrcrZXgDmweNSFWgLY=; b=sLBsc7Yjr93gGbTGNNZ8aao4X7l7w6iPfhtxsYnqfRP3BLIzzhlVgLU/JaZcn4AgQg 8l7kFFQOQzhdDjrYroE1C1EPGxBj8DH4v/9wUNY9IQWehB8PBGF+tTu83PjedojzEdxf 13kQVR4eCV556KjaLPchht1S2CjSh22BbE0fs/oiyCHFXy3uuGwXBO1BJDSapYEO77V0 DEiN3PNQnbZOemP0rwV3ODUCHC98yDBEeAPqBdLtQYyv05cH2J7MauJCE8d4SYEbyoG6 xPeNd+htfZuYmMOZsJYLh6q8Rl2zU7pNY+ncWJMGbXZIqz8ChYu3p0Ac6BCcmzPQhdzB nzAw== X-Forwarded-Encrypted: i=1; AJvYcCVQtbIeglgZkuWf0AmzzXiQYqG12r1CRxYhOem5B3GIg8z5O6Ut4sGEsXV/mUkqIypKZWLKBFjkWOJl0A7Kczdqp491SHpmKwtNXOXan/Rig6E+Pg0= X-Gm-Message-State: AOJu0YxUic4yxN2DS6WbrFvA3mMLmihiATXMjuCRlBr1jvgPhr0ZH+tS Q2yVaOVI7o90JKsMgLH/JCER6ApPm7NhptFyb6gGMB3v+R69AaN+lwBUJ5CLhig= X-Google-Smtp-Source: AGHT+IF/xqgp3fX5/73q32JxRWI738lXHcWaaxk8rQf5ZvZitjmwwt4tX7txoPGOt9wBMUleQlFSDw== X-Received: by 2002:a05:600c:1c82:b0:426:59fe:ac27 with SMTP id 5b1f17b1804b1-429d486efd0mr4284805e9.26.1723469665903; Mon, 12 Aug 2024 06:34:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:25 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:58 +0200 Subject: [PATCH 4/9] memory: stm32-fmc2-ebi: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-4-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=1886; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=h5GVRyPEyZM7BuYLl+uIGy5XE4aa3GH8V2JRysNGv/A=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9UQ2G2MLUWfrT/ljckUzPqu+/Ti/gpvU3bj vLbozfzG9+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVAAKCRDBN2bmhouD 1/h1D/9FBIcRGxE/iNnzoy6kaQiSTt/zZow9zS313YkYxSmkqUcdnFL2JyYULkVMPta7hVQ9v9O bZJQVD0bif8TRwAQp1cB71a4T1IENrkqzP4iwFZ8087G4vZ9NdHeU9aLruLynBs9/U631XugQ9o SFXgY5vliVBY1jbiRMwrIPbvEPecG1O1/TKbCJYd8ZhjkDXln2l1HIVce++fZhyE07IJqPqBnI1 8sUFAOB8Eme5pmhnTfeYVvoJ56i+shfDHmsBeEdwbG2M/iv38XN2rrE5+q79M5epLsDdyQr5doq 0fafsJQocAYUgPZVgrdmnBcjhb9zEKgFVsPdEXvdPU1QW4t1RvSS+RzzrLbus/05ljfhwM5Ot0K Z6DywmDKh3uT+EdqtuVpHhIs6rcfAKyjHyEPg4r++MXTNRVWw1062emp7mAlljObs/Tqllgiu78 uP9yE2NcARpF16zI4YXRDne98RDnw4oBeRx5oFD74w1SudLrioM1ouoFicZqJwMjrSAjuhcRb8K +dGLLs8fPAVE+GsBu9pu6z++punmdkhJfIqdCX1VCPrYHcYg0aOPPsaA2MgzrD9+gd5o0lRsQY8 BAQtw11HqnTQwABAZ1MS5FtvJDkJelkJxE9hWQZZskoCPIq6vj45Ab7Ud2anz27txnCtpZ3ZNwe CmOBzjUDD19MKwg== 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_063428_662227_ECDDA463 X-CRM114-Status: GOOD ( 11.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 Use scoped for_each_available_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/stm32-fmc2-ebi.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/memory/stm32-fmc2-ebi.c b/drivers/memory/stm32-fmc2-ebi.c index 1c63eeacd071..7167e1da56d3 100644 --- a/drivers/memory/stm32-fmc2-ebi.c +++ b/drivers/memory/stm32-fmc2-ebi.c @@ -1573,29 +1573,25 @@ static int stm32_fmc2_ebi_setup_cs(struct stm32_fmc2_ebi *ebi, static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) { struct device *dev = ebi->dev; - struct device_node *child; bool child_found = false; u32 bank; int ret; - for_each_available_child_of_node(dev->of_node, child) { + for_each_available_child_of_node_scoped(dev->of_node, child) { ret = of_property_read_u32(child, "reg", &bank); if (ret) { dev_err(dev, "could not retrieve reg property: %d\n", ret); - of_node_put(child); return ret; } if (bank >= FMC2_MAX_BANKS) { dev_err(dev, "invalid reg value: %d\n", bank); - of_node_put(child); return -EINVAL; } if (ebi->bank_assigned & BIT(bank)) { dev_err(dev, "bank already assigned: %d\n", bank); - of_node_put(child); return -EINVAL; } @@ -1603,7 +1599,6 @@ static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) ret = ebi->data->check_rif(ebi, bank + 1); if (ret) { dev_err(dev, "bank access failed: %d\n", bank); - of_node_put(child); return ret; } } @@ -1613,7 +1608,6 @@ static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) if (ret) { dev_err(dev, "setup chip select %d failed: %d\n", bank, ret); - of_node_put(child); return ret; } } From patchwork Mon Aug 12 13:33:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760600 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 E1969C52D7C for ; Mon, 12 Aug 2024 13:37:03 +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=iYu90t8uzYSzwZwxstiM099mVmkqpDjtdWc2Qi9XDBQ=; b=AhrlB/lJUaAmsm9jhEYnDSvs9B GAa/loqoHf9uk2ISaNrBPm/bJWt4cOCYhryzX+g1CvTEVXCgmlqRT0X6c6/H5zrycVORCQkqzPT1X KJG+R7VGyAmp84G/XLRTBfLf3Q3nNbUpKrhK2B2naUAdwAFDkWS6Cwu7rxR/RDa+59iPSSTRPPkVw FqOVpzYMyMfN337ABpa3CoLiN82nENWetjElO/8tZIsl98hoZeMUpj+47FLT2tCZ5li4VgoAAaVqa emFHy+BNthJqXMx+oA81a13j9oNYIhLY5WzSVE/JtnIX7odIXDjDeAdMadYkBHin2lgsvUXB6Mlt1 ayCxtndQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVEB-00000000Rc2-0e0x; Mon, 12 Aug 2024 13:36:51 +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 1sdVBx-00000000R8W-2M1Q for linux-arm-kernel@bombadil.infradead.org; Mon, 12 Aug 2024 13:34:33 +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=iYu90t8uzYSzwZwxstiM099mVmkqpDjtdWc2Qi9XDBQ=; b=meYBDayWm4PgyZWqz6fio9rUsH VghdT47iF/tWAtaEH2lb8YOr9mJX/9yB4Ddj2eWt2UGqgVeZINHr8QL0dRrEccwa93JzzIgP5bwj5 G9ddUGFcMKUXEaQOKuRpElpfOlpqV0Y6rzUFhn1/UemavLrNZCSZFtzn+HW2Xens4MzPxCNlyBG9o T9fRqLlHOOMXDY9MjYiRgCYmqPFv0k55R8oWU74UCfocy9n8RrAfcQvaOcfZu9WVuYuziEFPBceCQ qsAVJqEFBs17+ZjrYoqGmJpk4dqRS8R8np2/2qUyFOm3Gl2oTz9mzeCjcZqVNVvH/kefMItw5f7Rp HGrSu83A==; Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBt-00000007ZZO-47CE for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:34:32 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-428163f7635so34158855e9.2 for ; Mon, 12 Aug 2024 06:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469667; x=1724074467; 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=iYu90t8uzYSzwZwxstiM099mVmkqpDjtdWc2Qi9XDBQ=; b=g3FeLjI24ZGdYWOUkH/RPBx9RTjoafXlxHkrwLCwfTPF8Wu3YuWkZjYMgLgia3SmRh nTCyh5D8d48+iMUtWtPKbSpuJfKspYapmQPQJVTw/L/1SZS1shcRmQb8EOxQFBRhNLBI ZmTanCPcacXd/ddOgTCAOUZ3VrruR4RKmVWwqs9+YbicAqTHI3xiYdrcDa5mjdY+8DBo phO7PbUY26lHM8NYvS18WN04sSxQM0s6Bfau80MTwZEzA37PHvcgwCIACl6zxCx3jC/u fp46XdUe18dPsnI1FvWGnTa06bUO0buYqB2M06h0/ab+D1V3+La1f6zlK0tmdFvQBhNg vKTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469667; x=1724074467; 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=iYu90t8uzYSzwZwxstiM099mVmkqpDjtdWc2Qi9XDBQ=; b=PeJ4b4KWQQyZXE/RJ7wwqnncBgTN8ZZDcW8cZculUf8hmJbOmfAk4QIt4itS8RyE9I NDCc9PoBJKPBuMAVgBkwa/DoUn1o+zjptRnzNZ8BkAHzaXwWTS1uaHZu8mGS0DFZP0jA lFPCZFkoQ23YOygT2r0AxZKB5/VtikheE1yCsJ/PmvJJtCBLQJHcEchRYftly8f//u/G /qDVJaECwkvwAzQyshRGd4pbnuNOwN7Y/Fg/ITwo9L8xakRTGwRS9i/H5t844zOz4Sje 33Ez9syyCQsvIjuF/HnnAHV/t1EU032OkO056wJD3yebj7fFdUIN5IcRbFLQP+UajbVj 1j9A== X-Forwarded-Encrypted: i=1; AJvYcCWM94fInZpZYf/l3kTXkhUFJGW+dNN8PfwulYA02iCCM3egx5+dir+DyWwLujji/YVZVqQ3pddQPnwNTozT/FIcENx8aYrp6h+HgEhVGBG5+eQzU/4= X-Gm-Message-State: AOJu0Yyqwe/14XymHvjurJo54t2P7tq6LLR00hpA1Oa+ZCrkMwXXI4Bd Q6SMODx/FMDggR61pJb6rI4QNl/+dHCkB89iDaJkbdprEn2i1QJkzYByR9ewDuM= X-Google-Smtp-Source: AGHT+IGo+bwIOsZ7HKzwRQ/L9wxhGpzJ+9d90EvUl3/LSZZSk74iCon02t3qgWPnZGmK+APviAH8lQ== X-Received: by 2002:a05:600c:35cb:b0:429:cc03:6450 with SMTP id 5b1f17b1804b1-429d47f3d65mr3847725e9.7.1723469667400; Mon, 12 Aug 2024 06:34:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:26 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:59 +0200 Subject: [PATCH 5/9] memory: tegra-mc: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-5-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=1844; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=VUl2omx8TySNDGhRBBGJcq4Ai4teD6LWmoYd+wA7nBQ=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9VH3wPyjxN/t/zzCvyjeYSsYVX7Jz1ga252 UjCTUHqiJ2JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVQAKCRDBN2bmhouD 18dmD/0ewHA0UK0In5nae64KOCy+CAeX+7EsnZCjszXwHpXtbtbje2b7d8Br0Rj7OsxqkLkswiK 0TtfIJ7JhGZMAjZ++tIyxg3wlqEt35RQt4H+PQvHeDLM2XZ+z9CKTc05uuZqynh/PpvkoXHheOr lO8TR4iguvJTFmKmbSieHEgcEQvDqZL+SnWoADGWfaRqTpuCvzgMMuf+2qPqqnDNfcregG9QgKO +w60nKgkB4CLB6FMMlzAscW23AprITn6TCuZEBd9s9Ml4+hp/NX2QJa/E79ozdZpjz/6nT+JZi2 7QUvHO4EcccyTIqhqcC1Ggezg1vmaglKJdKUI980UDR6GarxWnvJwrNaTIjoOvUnidQNMAbw1E8 Brc88ThoerIMUAaRW36EdH2jze/ynNoiK+qJUZnNdlK9k2d+ApRPCR0llnQTKj7OKVxe92jKUT3 GEYOBQ1Vf6C2aD2syu/gERy554GaWVbVPHBmvlGYFw8VyyirnITcYyw2ElKoHJGTTySSedZp2Uh TUCYUuos2eEzx/EOV9E7LDPfrFWARV8lZefX+nMIUZnYSj1WdfPfKnxWM7S48WuUkXVDaHSNIyz hYY0EVe5bcenb3qyxNONkHg0IKjxWPKwtIzWFh31VxXLQoZ9VXrteRJhyEqthWTt9f6GZALFo9O hWEevbAzA1E3pYQ== 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_143430_390561_485CCA65 X-CRM114-Status: GOOD ( 12.99 ) 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/mc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index 224b488794e5..bd5b58f1fd42 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c @@ -450,7 +450,6 @@ static int load_one_timing(struct tegra_mc *mc, static int load_timings(struct tegra_mc *mc, struct device_node *node) { - struct device_node *child; struct tegra_mc_timing *timing; int child_count = of_get_child_count(node); int i = 0, err; @@ -462,14 +461,12 @@ static int load_timings(struct tegra_mc *mc, struct device_node *node) mc->num_timings = child_count; - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { timing = &mc->timings[i++]; err = load_one_timing(mc, timing, child); - if (err) { - of_node_put(child); + if (err) return err; - } } return 0; @@ -477,7 +474,6 @@ static int load_timings(struct tegra_mc *mc, struct device_node *node) static int tegra_mc_setup_timings(struct tegra_mc *mc) { - struct device_node *node; u32 ram_code, node_ram_code; int err; @@ -485,14 +481,13 @@ static int tegra_mc_setup_timings(struct tegra_mc *mc) mc->num_timings = 0; - for_each_child_of_node(mc->dev->of_node, node) { + for_each_child_of_node_scoped(mc->dev->of_node, node) { err = of_property_read_u32(node, "nvidia,ram-code", &node_ram_code); if (err || (node_ram_code != ram_code)) continue; err = load_timings(mc, node); - of_node_put(node); if (err) return err; break; 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, From patchwork Mon Aug 12 13:34:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760601 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 0B4FCC3DA7F for ; Mon, 12 Aug 2024 13:37:39 +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=HsPnMwUlmEcWVK9mERUpPYYwG4/ZxKmrdaWPZk7BfDs=; b=Kyf5qO5GEUAHsY5d6VKRiW0cq8 tKhxhh4UD7mPXlh6M/GdQOGVVfgMoohs8fpCCH3T67N4h8uzUBgpdJrLcwGPqX0Ndf1RZHyeBoAie 7uwGwmINDUzlWnIaBRklBb9AkJh1Ymj9JqYBvidx58xJpmdm8WJ4BVyHlJO3FSWExuOBbEzhVZgYT mkACbc1cjF35sDEjOhVQEhu83N6P7DrX0QWTW2K5T413cygArqFGzJz5EE2VpDRV4n8ZTHpPbbb2u p0L5eeOyLtVQfwHXVX4WP7pBEzhh4acga89qDPhAtbIdxYVaLwhRncssNCrNEIgPozirQSPmOCJtD UjS5Sn0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVEj-00000000Rj0-2i51; Mon, 12 Aug 2024 13:37:25 +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-00000000R9C-1DgM 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=HsPnMwUlmEcWVK9mERUpPYYwG4/ZxKmrdaWPZk7BfDs=; b=PdFKUrx//fwulRFgack1LRDuzG MBy38Vc7eeQLGpjIu0ddQJEJjc2iLcKvvBuHhe3q3xwFv6R9I/7VmKDQVr3XI02RxH4gHzZAmDJPm CrAARAYpHfcMssINA7Xs8ZfXA+XaKLeW8lT3AS1uLkc351uG8dWVEqXPzz0RJumVhwHuL9dPGW5jj Ame3zB2TPshk5d/g5InDxz8KHlLQBj7x/QydpMKn+U13CrNMCDvblz8XYP/HkWBMj+tgkwwy/HV5H JzZb4V0WEia1xh2byuY2W0wzP2nVJCQAp1nh4z3WWq0Z0cRFSnF73SlkmMoAuy2ZKN+Kb9/NaueQq beGPXF7A==; Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBw-00000007Zaf-3yPY for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:34:34 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4280c55e488so25330705e9.0 for ; Mon, 12 Aug 2024 06:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469670; x=1724074470; 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=HsPnMwUlmEcWVK9mERUpPYYwG4/ZxKmrdaWPZk7BfDs=; b=xGvPO9CLhaDa63DMXxWCow8esELgT13qOmo9sqdC2wvVkb6OC0CPdF36a8mHARpgVd iFEXNcAHVzhhXAF/FLNt7iRRN47QupQNauwxt6WFPL7cbTESQg3s9GyA5WhclPtMpxlT s1m5bnquW5iizsPFhQuCjQDeP4RwgFiNnm4vBLv3fRg74DELQbBVZIvlICT3BfaRAxfo MW0ayds7qqf6cRvhHqvjTbgdG3QEdq1//dF2lXxcZDHWDKvLt88rxO07abWsE4wUKYst 136WySrdoy/af2cWtKBra/1Ozo+/HxKmEKC6M+dG47hHF4K9zJILH88fRZCUmvgLkenF J7KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469670; x=1724074470; 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=HsPnMwUlmEcWVK9mERUpPYYwG4/ZxKmrdaWPZk7BfDs=; b=e/O/lNpcieyPSt+ne2UKCK8P6s8uc3Gv4+slz0c0Xm+7bBxvK6LkeRiMaMgBMe665w qyQupSCdUF3z7LMKUDFxBzf+70XQrMLHZM1smIJj1C1JqHHkejFgoFTABbILDTVNg6mj K/stVBqsgtWeNC75zx4pPiBC/pwS+ugeqKADNrymLGh5EbEZjhW01YwukHCsQA2jnbDN xxsOeaFpJ4A4cz7bi/9WNpDBXmfC4+y6DB2bYIyvZleaGadtakj5TEmzF56Tai/OMtlg KZ/cRvAhppd+uBoqr59H8/Ihae3+g/dZNkORZ9ReY4AbGKNvoUZydM+K++HYya8KqXm/ PXoA== X-Forwarded-Encrypted: i=1; AJvYcCVjb3ztSGIBhwGrDHtspDyqp8oAeXqOIxYRTxvsxJC8EVp4XzgKjrTbi0kbf8XWg6UuX76HJWxAxs+TCssRwBoAK74xlKQ9BSRB1ghm5/9cEmWkkMg= X-Gm-Message-State: AOJu0Yz2tUic2xlHyV9J6+cuHMGgJVkrs0FO5WcKoJ1vdCtSOR6i+3Hp 827ErcFWXeeA7u8DbEQf/VdB4J2TuI70dlx3+nIwCE8EIsnGbGpr5DJ0OITI81o= X-Google-Smtp-Source: AGHT+IGNiDAP0NpC4elbocTXmRTxZwypqEwP2T7NoNQBek7gp6Czs1sj30tLHKhrLESNRMviHtEwcw== X-Received: by 2002:a05:600c:350a:b0:424:a401:f012 with SMTP id 5b1f17b1804b1-429d4ce06abmr1140655e9.3.1723469670362; Mon, 12 Aug 2024 06:34:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:29 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:34:01 +0200 Subject: [PATCH 7/9] memory: tegra20-emc: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-7-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=1217; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=0agCSQdAmRYcJrMldLHC+cO/HYUzM/jNOwE7xvoTJWs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9WsUwse3YgLVrnCc6/fae3A3AcursWIyaSR hcKG6MOheaJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVgAKCRDBN2bmhouD 17skD/4mk0mqH2rEuc6Lpcv9Fk9Z9Ofg651HdFCPIT9SXWaxdSmtuzFF10HgMdna2jAU8gVSx5a teBho/PIDCcTaBnRl2nfMGaohe9F6FvBXUBt3gyoUK8ws7VHkvJDSa/KJPlwupUztYS3WvUSHFJ /EKc9LxNYJ8WOl4h+a0KHjCPQTOMJphsYrmP5wO1v5mHNoWuBnbxURpMSzEe0EXtHGKbL7ftoyN V/BvKwz/AlFcGp4vn7CRcjByp042rkUjWrM5C4QOffDdnaEVCsGlTdPd+Q9j/oGG1oPiwjNj9Rk EJXOpzGg5QR2OlVBAR/BiPH/O17Zo3xLAKEYGwnEv+9n5xQfoRhFkU8txLoW6kUVxO5EHRHQ9Iq VYYUKRr3n4cNsQXegkWk0h9MKqG2jWOe/sLHWWTNQTxBLqOo0PtVSqPwNVK0Yo4xadzdNZ4B/xJ DVjB1RIhzwfhUHHCqwIVYmOMmTnMUTTJZz3r3S0skj4aAHPWpyPj+S23pPD8bzAWFXDWETY+Vsy Qk3XC066YomliavGy2tfSIyRH61lPSAHFkN3db4nQcAqKVS8DlXh1sFwiBMUK1q1oAPQGu22y9J QwLihlnuAYhwjSTYotz/5tGVxKjNaIefeTjk+X+fU46eFbpPJpU7TYmqN7iQqDK38/OJ8k+YGO5 /7zMI7a8ZaQdSXQ== 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_143433_183486_2127822E X-CRM114-Status: GOOD ( 12.87 ) 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/tegra20-emc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c index 97cf59523b0b..7193f848d17e 100644 --- a/drivers/memory/tegra/tegra20-emc.c +++ b/drivers/memory/tegra/tegra20-emc.c @@ -410,7 +410,6 @@ static int cmp_timings(const void *_a, const void *_b) static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc, struct device_node *node) { - struct device_node *child; struct emc_timing *timing; int child_count; int err; @@ -428,15 +427,13 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc, timing = emc->timings; - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { if (of_node_name_eq(child, "lpddr2")) continue; err = load_one_timing_from_dt(emc, timing++, child); - if (err) { - of_node_put(child); + if (err) return err; - } emc->num_timings++; } From patchwork Mon Aug 12 13:34:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760602 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 8E8AFC52D7C for ; Mon, 12 Aug 2024 13:38: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: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=oAYRAyLvoG4oyvTDF3Z4505Z3pwRnY5SCeviwv8U1gY=; b=BZbP5XKWX/KiGH+32zCijAXqWv nhapvYiWIj+g8Jx5kdvCjXSAhd5tv9KmzeCPGlufGl3FzA+qlzL4RIGHCHsCWbQx3uQUeipVk2Dp2 JDP+dVmRE94uunwOLYJbD2C1KWk9EzQqp3f/Po1zzjuRSLWBvysYmt6oRiBktYFxM0IHXVm1jm1Tm wBdWYHuGZG1czxEWMU4/WZ9s5ri+LtSnEcy47G/RCrLbo4nY3iSKqk4w/5BC74fvsR9QACV+BrV8L WB6ctQBq9aZcWou0u0UG6mSdTkU9kNE8vEYNUwokr1d9QMdgftW3V4QGIIebDGrDiX8EJXudozZo3 j2mvwTFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVFq-00000000Rsz-0aFj; Mon, 12 Aug 2024 13:38:34 +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 1sdVC2-00000000R9l-1bq7 for linux-arm-kernel@bombadil.infradead.org; Mon, 12 Aug 2024 13:34:38 +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=oAYRAyLvoG4oyvTDF3Z4505Z3pwRnY5SCeviwv8U1gY=; b=jryg+Rym++DICZ9KQkNigcZZRR XzCZGttNd83A87FMPSQUFBOPm0njInTT1rxbYve5pxtooVR8Fr6JpRb/D171zNmdDNsZDCbCl8PyG oq4Dsqnr+2kdxs+54fok98TMHpUzHgZFesh7BscGxENDNpv8Eh3d4+74LlUXwwKnJtbTm6lMFQfXH nk5AdQv1tMfOFpVAP3Qi7assUMfNwQIfxLNzpM+ypKM0M9RGrAoVtcMKNoGLyagC8T+vgtBuHzlIl z0bN1h98HHOqy0n8ewehmkERFy1Q8zPLf6DlNh6YyJfCNkSW/mwhoB09Er51oLXmQCTmZ+3ghhhgn qABFS9ZA==; Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBz-00000007ZbE-0Z9x for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:34:37 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2ef2c56d9dcso49656881fa.2 for ; Mon, 12 Aug 2024 06:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469672; x=1724074472; 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=oAYRAyLvoG4oyvTDF3Z4505Z3pwRnY5SCeviwv8U1gY=; b=e289oD3HFrL2j/ZGpHBxY2PGRln8EiD37NqlMX9xurGsoY9lCh+suAYlFqfMlir11m RTbCfx2CQU7jhJQg4l6cgzKU7NZgADfxEyC9f1XFxzQSZ0UI/tytpWHUZr8VmwHdtPME fXHQD9XrIMRCRqNi2juF/rPJn7h/AJd9Z4pL3BhvPJFIyf/cpGwvkqi32+8Qvjc6+r1b Ed7F8mB8oEKV7kEKz7z1qv4FAa7ZOCOHY1jr9jwWsPiRVOrKl5fFV94byc1oGQY0k6Xs XVBBXu3vFyEtDu5DTeW6aX9mUGfq+NJVKvuTm9rBkVMYLnW0nmu1EAWHraoLIhjjinWc agKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469672; x=1724074472; 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=oAYRAyLvoG4oyvTDF3Z4505Z3pwRnY5SCeviwv8U1gY=; b=C8OsZguyF67Qtn7P4M+GwF1rF9eTXGDhmq5IocWppmdz8FJbySooc2/ib82MPW8+7w T6KqGFVxbVEbDR5F4HauKNVanUbC3OKzYPBjnZONy6CT4hKlQOPQLm4DCmSK10iP7OgX syF2Xf3AqLAO6Dx9hF0iu9up8PqBt0L+a17Zec/ASan0WZbQzKn5rRQB+BtjwIHzD7jA q3EuhKWp91p7DE95uQFoIII6CNJdCS87XSAWrV5gIA6y6zTflkJXiOdUDVC7PQB+4bg4 jiCQifN35wJhKWhuaUKfzBj2lwbSGXjjOR7PXKcauvMJJfTNCoIpdwR0Q56zPwstHyYV ou1Q== X-Forwarded-Encrypted: i=1; AJvYcCVPEdRKsxHc18mqabGm9KEshNKt7HAHzsE7NCEeT/xbZzjoECaRi7tbfDQ6H3dT2T62QcQAefr45+y3pebRjOFYQj5C7xfBhPUpDul03p6WNHbJJ6o= X-Gm-Message-State: AOJu0YwDJ4d8MQ+bSgmtVgPDJPjaK9IFj+tOXv1JLhcLU1GoNePWzxXo +GQkjPx82Br17IHbUhx3B2aVyc78sNffZrOHsPQ5zGQBrumPcCPqIo8AVHfMWyc= X-Google-Smtp-Source: AGHT+IF4Zea8h7AbclFyhVQtS9eZT2Tc6EMfJdGvwHFdzc3KpbF32S6sd5GGemZ+KlUJ1S/LzaVfaw== X-Received: by 2002:a05:651c:b29:b0:2ef:2281:2158 with SMTP id 38308e7fff4ca-2f2b7132d7dmr2306451fa.1.1723469671912; Mon, 12 Aug 2024 06:34:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:31 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:34:02 +0200 Subject: [PATCH 8/9] memory: tegra30-emc: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-8-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=1224; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=Qm8I2XYrN4e568eaRkgeUjoCW+fRdkjecwXHEHRljxk=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9X8NotaoXkCeoFvECQEThprz5ONHsMuzD7b NbNcj+DjQaJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVwAKCRDBN2bmhouD 19OvD/94A99rooiagSr1yUUB3q7Tj/0CpbQTlx8GEwagkJMZgezQJ8fSt8lsJRwMBXaisbT1RUu /ugtoQOyBWqkLkCZWhr/dt2MLe/xTHkqATxxMe/q3D+SgaGpBqnpb8s3OCcUoLRH2zLUgkSNI/B uuVVzd55ascHajpNWi6sBkx/4Ze24W/M4Kzrur9iytpTE0r8vhXx66INDaF8DWK1OKaSFR5C+87 Xi3jQE9JUlz3sNAXyieSjga2IaM8ORwSZu5uDrQ9H5dih3U5zFbTcVXbvZgWBaehrOS6NJfiCd8 SzqME8XywWSTxtLCXarn4TdGn3FqnR/O4walESXFoC2LygReE3WiwB/R+ZBHx3iQ7m+4NGDKZK6 VBpdwrbh0T3/x+HpB1Q1KJZvfqxuUUEOFea5K/1geiiMiFJCWOk3r7PxgZgoHWn4SwuTSHrvFYI +219oxZut/xhcq+BqRzL/oR4EZ9TyOFAxpt7eqTU670YOGIom6tb2FG/KaN0L2UuCqlodmYVNsY iJbDxcpq4gIrMimT2QT6S+AsS5JZAIV6l0Rg+otm9KBlrSMLK0JFVzGsM/vcvY9suDvqXV0rtwP LNsXWOvL2mgzo2mkBI5TGQ0g7g9fhaRALj9GU1rbiyjbDY3dZneug64Vgj4jUmWBINShFwvH3ag Y/cmVhGViQKghBw== 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_143435_446146_3F13974B X-CRM114-Status: GOOD ( 12.34 ) 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 --- drivers/memory/tegra/tegra30-emc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/memory/tegra/tegra30-emc.c b/drivers/memory/tegra/tegra30-emc.c index d7b0a23c2d7d..921dce1b8bc6 100644 --- a/drivers/memory/tegra/tegra30-emc.c +++ b/drivers/memory/tegra/tegra30-emc.c @@ -979,7 +979,6 @@ static int emc_check_mc_timings(struct tegra_emc *emc) static int emc_load_timings_from_dt(struct tegra_emc *emc, struct device_node *node) { - struct device_node *child; struct emc_timing *timing; int child_count; int err; @@ -998,12 +997,10 @@ static int emc_load_timings_from_dt(struct tegra_emc *emc, emc->num_timings = child_count; timing = emc->timings; - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { 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, From patchwork Mon Aug 12 13:34:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760615 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 77132C3DA7F for ; Mon, 12 Aug 2024 13:41:03 +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=KDjln6hpCDXYJ0URbIXokRubyMBzSip15NzhUO8TB7c=; b=EJGMRV9f2n0b5ZhxlXdwgXR8Rd yUlVeEqKxx30+MOtP+zmduJJEQAzBWI+ytww3FXwGLGxvvn/bnGOmqfmIQPUa6Gb6y8AjgRgacFfu tNyFcUwbM9DiMT6wV/JH4NDtBmIO8qIdZ+cKifJ9ufZIw2j4JFAst/jBhdYH3kWePQilB9uLyTxEl px7J+sZVc3DB6d+rukyd4J+kjyNl3Jm4NSvFRmCxx5NM28rwmLT691fokNPvaZz55wnbsEjYyrgfO BYQihFu0hVMAo377XRY4tPC4527frPcJBJQyUt0aQBnDEDOBj3ReB8PX9K+8Wy0YgPE2782B1RwLh W159vliA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVI1-00000000SAA-3AzM; Mon, 12 Aug 2024 13:40:49 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBz-00000000R8n-0aTb for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:35:08 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42809d6e719so33280555e9.3 for ; Mon, 12 Aug 2024 06:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469673; x=1724074473; 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=KDjln6hpCDXYJ0URbIXokRubyMBzSip15NzhUO8TB7c=; b=VM5So8SeYtZf0H6usyukRUBJhPqkSgpp3P58OrjefQcV1LyMUotDro5YG2wwRBeS7o cEczLXGJRZeSJF4288+fK4+Sra0TaK/HjeZZEVGaNCQNA4oar6lGTTAIXLkoqzotvoy2 /Nupt4z+6RDUMZ6bouNkdN0VUNLVXtl6/lqf8W0vSi0oBR3EK4e3JdpFQyNsihfVzfgj CUQ34FQqi9kfpjiB5HbFgTBms38UBpAq8liN7Nw1KJJW3YQOmDZQSA6s3zjJkigrm4Lo 4jJvsBtkZAeQvrUA3tiN/rG/8fBolOaZ6L7MWB1UtigMBpkWniNub4gAJR41Vgj6auwd oQ/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469673; x=1724074473; 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=KDjln6hpCDXYJ0URbIXokRubyMBzSip15NzhUO8TB7c=; b=QVQcjLvE4NOONGUUAFCCSvbeZ5isr3U3zqQ5RcV7+qB1AvGVwanpP+FTJyxETYxnbg 7QU6uANXZ4wWQY7QOdpZ3p3Y926IR6TmhFkkm71xImoezAvXgENtGW2nrfNvuLn5NQTH y4y2PRrKDEnprm0yUvFa/HVgE3OaqV+bwEIAZfPfcA1IwqVbb7eJlWIdCo1BKI9DoeXy Z+NOquJlWpIUnw6vHrxsiIoT9lymCQVNHtPgjKIH+EXVop7KF/r1UPcvRUvQHEhToR4d Jc7PGzxtZF1AFKciveShXxpwn5pHPiTuG2fGbpCEolvwmfuw8lKNvgqbNuUE+7Pm7+Fx iLMg== X-Forwarded-Encrypted: i=1; AJvYcCWpK+8TX6IpBe9yV9T/I/FLSW7o2qP/c3iS8kMDlNLNdmseeTzfTlzimPmHLIdPaX//00qkUsSUeiBM4HBDgAB/xldPn4+QEgutLA7ETqS+YnzWJOg= X-Gm-Message-State: AOJu0YzG6BqZcdZCP7hq7MaMlufKXjUwalQS/bgzeljJL8d/kIt+3Oaw kbx7ehGgjx3YVpcayJUroL36C8mZ2TZygkyO0iwLgOGZJxT4MBFhkvyQ/XzwosQ= X-Google-Smtp-Source: AGHT+IGxNdfGFBc2sd+uT8Mshv7zE0iMHxVPPRhCFdm+enI7xTfevgaIs4pdgcrzguVgeuzP0FcuHg== X-Received: by 2002:a05:600c:358a:b0:426:5269:9838 with SMTP id 5b1f17b1804b1-429d47f43a1mr3753855e9.4.1723469673377; Mon, 12 Aug 2024 06:34:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:32 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:34:03 +0200 Subject: [PATCH 9/9] memory: ti-aemif: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-9-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=1869; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=1y9LIZ3UpOVR4pnvMVqojw1S5Kf9CAK2N1Et998QgxM=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9YQQCkCmD6RWyldjxAxJ+p417Q43d0hTixW dLzROOtWr+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPWAAKCRDBN2bmhouD 1+nCD/9WeAq/6x6IjpXwsbY6q4WpzSCuLIsFjo3y8wWVAXieoqOsqOZ33OR2zlrlb5R7xqAmLOk n+hWanKoaIz81P6uaaOV4ADrfzpSGO3F3pljzOFcC5kjgcvvPffYqPKATl5sUjzZNH+GbX+OJRZ 0av395if4QbFFVZNGRncMfCo2pB8HZQQawKOrIVCOPLzN1l5iqgNomvHLRDECCa/i8nCeaWlmi/ 9UjCR9X02xh/BxZW74SjO55jI7IqLA9ohbA/OOGySP5UKVr42BoPn58P1GXpkfY6FZA+HZZ3ZxH v+AGb+6rq80Wl7Lz7DM4tVc3RniN66Yw1veXOM5c0CnQcQHGRGJDD0PV1Mm5Y/UEhTzsYmy3srt a2GcSDTHi2UlW11x5nxxS3OqY5xQ0lPmPn3y1UQ34g+x6gZpPZIQ5sRbQBNisH0kkU20pL32Toj vJG2V8EcF8BgyExdqs5VwUIyMk+IGrWmq9XPpedyVUo3qSrUBR657572wxtDIFSOEkJ4sPtKxg0 j3AB0xCbvaDIJIE3xaTuD2DMCy2Tqf/EocjX/gF6//BfmKUbuQQUFxqm5UCiuSihYMtB82scL+Q uQzGTpTFXzJKJUPlJUNaBiagiaOp0EoNTtbPKrmqybnQqPkBi7eMW/iiBy5E8nu+QOfyqv/mAoP uWIYBVUyjipVCyQ== 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_063435_223520_21734BB6 X-CRM114-Status: GOOD ( 16.56 ) 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_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/memory/ti-aemif.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index e192db9e0e4b..cd2945d4ec18 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -330,7 +330,6 @@ static int aemif_probe(struct platform_device *pdev) int ret = -ENODEV; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct device_node *child_np; struct aemif_device *aemif; struct aemif_platform_data *pdata; struct of_dev_auxdata *dev_lookup; @@ -374,12 +373,10 @@ static int aemif_probe(struct platform_device *pdev) * functions iterate over these nodes and update the cs data * array. */ - for_each_available_child_of_node(np, child_np) { + for_each_available_child_of_node_scoped(np, child_np) { ret = of_aemif_parse_abus_config(pdev, child_np); - if (ret < 0) { - of_node_put(child_np); + if (ret < 0) goto error; - } } } else if (pdata && pdata->num_abus_data > 0) { for (i = 0; i < pdata->num_abus_data; i++, aemif->num_cs++) { @@ -402,13 +399,11 @@ static int aemif_probe(struct platform_device *pdev) * child will be probed after the AEMIF timing parameters are set. */ if (np) { - for_each_available_child_of_node(np, child_np) { + for_each_available_child_of_node_scoped(np, child_np) { ret = of_platform_populate(child_np, NULL, dev_lookup, dev); - if (ret < 0) { - of_node_put(child_np); + if (ret < 0) goto error; - } } } else if (pdata) { for (i = 0; i < pdata->num_sub_devices; i++) {