From patchwork Fri Aug 16 10:54:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765910 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 8DE49C3DA4A for ; Fri, 16 Aug 2024 10:56:20 +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=a+AKBEGtmBS5pejKHsx1RQDN0WL4LYiNHXE6IWWpnkE=; b=sRXdqI/eAZvbwo26nemaz5Wtzm 6kNqKF42rlOfHVIoloIQHAQp5pBcwl827Aq3+/4u2jVNdE9kVQ8/ALNbbcA64I+QcpZDeZVl4wv7V CW4lCCWY7hnMKCEOira6fI29aFKvdNYCCfPHnCXdcwOKHzNFqdTZtLExn/H03Ws0nFaM4mgadKDJH qwWcMe4Z0eXrwhtVu5JgBpL6D6MtTwGsFJ03yWJEHE9wVG9QN2jG46Agf4lzVDVs47ns6oyDg4yaw b0yruV0GD9HuWlfq4mtX0dV99CN/jEiIVIGB20EyG6pikko70X2wCz7tEYHYFVCl+EjAHrKZxq2IG PwOPPEaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seucs-0000000CePh-2MMT; Fri, 16 Aug 2024 10:56:10 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubZ-0000000Cdz9-0DK2 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:54:51 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-530e22878cfso1860510e87.2 for ; Fri, 16 Aug 2024 03:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805687; x=1724410487; 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=a+AKBEGtmBS5pejKHsx1RQDN0WL4LYiNHXE6IWWpnkE=; b=R929pGy6EVKikF3zFQMlAP3l7oskMizjEDIbm5UzTqHsdoyDY8ygr9rRfcjNIAe9T/ Hl1dEOIRbCxFlxfEl117fYC/gk9EwUBSWTKkIeJr20YIaqdQS2e0SykeG2eXaJfRQ/wR vrphvy7I+BsktCwUe1ei1gHr8xPAIx838IGIw+bgdLYn4Or1UKKZJ1x2iYwveyCTGIWe B+KyHgj7yScwYipjSuxQ+OsNLJmpBSPAzGBUFuzmw5/lgy3p+76q2+IbpeCWZIsWmJuq 8WqUqwcnIvXm1Hqya68xNLJF7dnvD5txqgTI94+Fa2zg6vwnvjik++Oxq5k4XGhTn7zL 77zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805687; x=1724410487; 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=a+AKBEGtmBS5pejKHsx1RQDN0WL4LYiNHXE6IWWpnkE=; b=b7lovwNvwI6qRfvwDfuSI73vCy+kqYrj3DupsdiTEAo9KVvgE5rLJdhzzpMM1YbvEe g+Io1jNRmSB9ysAY61vkL5DeTC/cg0cfDfTTe+bHuhIkrEiIwAmZnZ4rdD5COdaDDWoo IzE8bWFQy+MFVAfYPE7VeVtfqeHmeefs0PJvJ81LncLyHOe7JQYkL+yDevLR0n8qxMml ZHvwjRU0zANqFchEWwyrH60JSW5m91v+mF4O4c8k2wBopUKtVpPWKwVz5jQXgDCTZ7Li oRGGyt9tJY3apndL+u8Ofaz45oCIsYNRe+58PPfcZXKed0/DV7XgV8P+5fXhkUl36CwU w8Pw== X-Forwarded-Encrypted: i=1; AJvYcCUnCzNYqKhI9hQYX7JbQBEIcxllgOAyqWQsRMovhT0xzgyk38YPCIPGOFdFmom6dLupxj/JG57UvoII7ehAcj8pk0gwWN9HLkwULDxlwY4ahTY+WtY= X-Gm-Message-State: AOJu0YzAgKS12XdunpFH+/P/KhUvYv2neei0PlYLRpr3KF2w6AutsOuo JUim7GeNtzKIYzzr2/JdIZbBqzNhlg4bFnHUSbX4DtUkXfil+9gW3fAfAbAmUU0= X-Google-Smtp-Source: AGHT+IEHCNscwqa+rPRNLeeVn6uCgC3dSDA6leygkbNxDpdQ8UnjMknEsIcEe+W0Kzt+2BBEbRz3Fg== X-Received: by 2002:a05:6512:1114:b0:52f:d128:bd13 with SMTP id 2adb3069b0e04-5331c6dca4dmr1237555e87.39.1723805686484; Fri, 16 Aug 2024 03:54:46 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:54:46 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:25 +0200 Subject: [PATCH v2 01/13] memory: atmel-ebi: use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-1-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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=2512; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=Y1tXQQLMiykATrg5422AQ20ni2RJaK4UYZemsQjrfo4=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/nVH8+q0L69iLHcs6Nn94lY9P0zHH98yQG0 wm6yDSp03iJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v5wAKCRDBN2bmhouD 1/CTD/4vBsb11t4ahtO9hgXQEOilBIsCGlpNiFvOhW+vWaNhLGR4ycmNq2tTW9pYLAxKoEhs9lm MmOy7g1tpQCAAH9pByIbx55vqIFfpDzKWPPo65H1k5tMHq19FOTxPLISCCxtG/p3bKMvmCuKUCQ PppZ5IiweAX7wT0y5MhYblCiSpuT0iS0A0C3zaS2NceA/pfLlsQciP1ryPAHSF0yGtDecLOjIZj kG93Ydr3phmWl239TCsc35QuetxOktkjec7toqqrJEP986JYxFde+IYseUDQlFdAl2/0oZp1zO9 1MyuheP0T4lhBiWejSAP3VOFzzYHvFyYiJ0FuI+53lQpOh8u3fhQ33cxUA2Bu/mJ5651qQM7GWB Z+ybSqTaWtGJ/JhXAS7Vc5T3YpI1WuX7UAxAzqZ/h8aJGSmXBS4lJXKnl5Qvilqyda05uEHaA5K x+QuyXZW15sg3BFzrUWXfKkkPfCtQPGfOr0Jy1pPCq/dsXhP1j3UsmsiOg8oSIx7/bNqliCgnrC KCOilpLMjwlQUKl8ooZtIFY7akYK7Lo3chtMeoQ5B1zz90dQ/lkLudzm/tQs2eGqv8A8fDVpFHf Tt/1mJjmAMDAtjuHf5xdKj21jLN2y/aU797yDF3Bj6HaUwDYgntnKsO/rtn6kXZeubNG4QJO+lz ibM4wB69kv5gAZA== 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-20240816_035449_157758_CAA03FB4 X-CRM114-Status: GOOD ( 15.04 ) 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 Acked-by: Nicolas Ferre --- Changes in v2: 1. Wrap line before of_parse_phandle() --- 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..8f5b3302ee30 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 Fri Aug 16 10:54:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765939 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 BC517C531DC for ; Fri, 16 Aug 2024 10:57:01 +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=6k6SD0aSljrln4HTu6lTRnYpdZxqX1kReSkeJCWA8tI=; b=a7EjR0ikKMTorBb1mDHjqE6Qn3 4BOqWSKTlcTn6/Vf0p7ORApEeM3J/o3zW6FonGJRpqEzX1M1X0FF+WO+BpzdeY22sb1khtpfuP9KC n2pLk1gQuYDG1U8zExA9PfcguSE+P7NtKUjS9+6nybJZecGjk/BFlvusNXhC1KWu99YFTfx4CwFF4 aVmHPY44QuBw2GLJuS2TLmF/+d7lVsNBYPYKh6z9RlYJmIjGM3LGhvE02y216eTL58DvnP3grnVaq /R1rCXyPp/KklBu1Bd7+rM1JzdJTtW4NqYvien7qed/T2yCW00qOtYk2MGs1VAjiD03z8h1nh9Jn8 Bwu0aI5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seudV-0000000Ceb0-3b5m; Fri, 16 Aug 2024 10:56:49 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seuba-0000000Cdzg-3Kj0 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:54:52 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42808071810so13273025e9.1 for ; Fri, 16 Aug 2024 03:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805688; x=1724410488; 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=6k6SD0aSljrln4HTu6lTRnYpdZxqX1kReSkeJCWA8tI=; b=t9384IuyeYJXlUO6srKNiuM0nCfpBYxfmsUvCotVOuTC3zHr/CLrXKFKaDdtAw+XTI VONWIXgzBgT/FDmia8nAUIrSnkK69EuWJvp9Ve7REvqufATiqvPH04gfbP0rBkbWuoQI WukhaBpfXf7SBKmtx4YG2ZGEWjpIqgFU8T6c0eEV1Ei/Va8jmRXXe0bKsHFeEzeZX6XK h1LbpKH91JLJ2P2AHepPt8LAr5BGj8oPQch5BnaJYbWY10lJbSoAvqjqDV07Dv/hPDNo lV4pCw73HxF17nyI0n5LIbNc959y4OiSHanABUZVQ1LhpgmKs9Xm/oVUpC/o3eTkBzNs 1oRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805688; x=1724410488; 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=6k6SD0aSljrln4HTu6lTRnYpdZxqX1kReSkeJCWA8tI=; b=fR/DXtrJCNxnXFGROz/rc7C6lMaw0qfAeM13ahAlQWxXunFPE6oxLvRbjm4NDZO9Ch XaGVXzM8Vml3DEhzOgfcmOTtm+vRkrEy0MVcwHdGXqIq9FUXWR2fpQzc0ihp2Hy3s2zc xcNEd1CoSoQy3dKCrCSh/sljKZhHFTiM/+8wk74bjpmBvMjUOYSigeUxZab/TwPLwWQ3 f22soQOrDusgDthW3pVg44rsaoogop7CdGfh8y2s4w7DBAO4ADa/upec0xBwpIixK1/j k4cNfZ2wMvKDF2yZTss5cA6BhHqXiIpP+d5zEp9fwvcQS7qy14XFeKC+OMEtLQmMCGwm 3Ung== X-Forwarded-Encrypted: i=1; AJvYcCXpdA4BaoweSMoNeWRFkEF3d5OoiJmpFuoC90CQYEXoXpvjoszxStuseIRuBLKiVN93CL7t9P8V+qqp498erh0N@lists.infradead.org X-Gm-Message-State: AOJu0YxrsLKg+I2qtl2+vPSRKYzLEsK6evkJ1uP3cEhh2ZSb3YEvJWai CaeZuXtPaZnZKyGFzYZFAaXQfcNBSU2ZjRlCN4wjDmWMkM3XEEjVOgdrfHpRyfs= X-Google-Smtp-Source: AGHT+IGySjZh+j8sC30c+hTT7NjTBz/cevAJKuIL9WcydZdhm3gwMTKibEaXN40CzJLmokWv8APCXw== X-Received: by 2002:a05:600c:3114:b0:428:ec2a:8c94 with SMTP id 5b1f17b1804b1-429ed79b8d5mr18949045e9.10.1723805688147; Fri, 16 Aug 2024 03:54:48 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:54:47 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:26 +0200 Subject: [PATCH v2 02/13] memory: atmel-ebi: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-2-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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, Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1411; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=3WljQ4S40lAJKTSAlp1/rnFCza433JZA4ZcGKxWq3B8=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/o4IJ9C/1vwBLKqlCDJibipxPCOssPkOBVA lUD/dSK0cOJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v6AAKCRDBN2bmhouD 13bzD/90oli7rKlPTyFDijLjZXCBlyAd+gOeBxMucElPf9bjthSj/d0Egf3LFElhNSpgHbcUgmF IYrSj6gTIQEcTMdT7fImXfCY+JHRweAnbhPn1YLAAUiXVWbrQEVN/q9CP6dRReBP6TDqUq78YMo jtmFQTQZXuvbzlg3k+Xe/nBuLdBAK6cAX33qOqh3z8rXzViLT8utrBWPjDGCjisjUQPv9O9NP9d RYwrjNXGpSSrRkYZalG9QgCTN05F1So4ML8XYR8qMqvSSv9qxFbuUPVESf/UClUPyjU/TwN6Ee9 /joZRI/TiIXgYhGD/+yYi0snpZTHJ6SWPVTGfvZESeRS0sAWQNWsw+MuNAi0QobBWrX8RQ4R0/c etqFzpwVoq7jRthBRauZO7cun5gyO35V9OpT0VkPs6q8rZFjnfXgsAoS3ReKiSMG6pawA0KsAxd hKkmg3DXaQ5pFlR+KODklIz2EvAMcUxcSE6vdOGhm43uJYUCwPzHhiM0xYYw8mhMY7h2RP04s8L aKJt4lBa1kyw3xqW52DwKB+NY3AqxMaZvoVTpVOgY3nlZG+hncKHA45VECUGTQxFlXhHhBYFO9S Osh3WKboPcOZp5GVEmVYHFJi80NbYJXdmSgTh/5mjqJEa8/ne4JuKAzX+TpRgQD7+pWdP13nzeI 7bcaQ2/6/4azprQ== 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-20240816_035450_870234_B8B42760 X-CRM114-Status: GOOD ( 14.09 ) 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. Reviewed-by: Jonathan Cameron Signed-off-by: Krzysztof Kozlowski Acked-by: Nicolas Ferre --- 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 8f5b3302ee30..8db970da9af9 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 Fri Aug 16 10:54:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765940 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 9A0AAC531DE for ; Fri, 16 Aug 2024 10:57:38 +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=Vjjz5PQxtXSt4zeT/RkSGh8NQkwY8peMKp36Eteyrx8=; b=nIJdHv94DCWVwlSLVohuSGgMI2 UPif21VM0UxPoUuZDUEfwPVY1pyy2fR5q/x7HJzj2FdG3kID4wNOp66Zc5LmgIbSnm/0sa06pd0ZE bVgGM9sx71rIWrRMvvke4M77uQc/HuMg3UHyAXIP6PCSNbcyeC2RIcBB5AOh65aK8Grigl/cwn5qJ qGnJz9Jv0j3wgwV1LxfhylJ8qoM/uzCVQo8il2lOh8+J0gwKgbZPK/qDT8rdeB+omzCDnJLHi1NSq KI2V738gMLn9qIEiQFVPCiW/xE251bUmQCFndSIaTDcGOpN0KHoJP7NB43NN8uxHZrT12TlzQ0n4y w3xl4AvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seue8-0000000CelW-2c3A; Fri, 16 Aug 2024 10:57:28 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubb-0000000Ce08-3uSm for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:54:53 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-52efd530a4eso2991574e87.0 for ; Fri, 16 Aug 2024 03:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805690; x=1724410490; 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=Vjjz5PQxtXSt4zeT/RkSGh8NQkwY8peMKp36Eteyrx8=; b=uoPFee4wkWBxJINglpo/1umOnsXlKeSxyxdhQbKVm5izDrBiRNNXgLcp6m+jDpCn1G zWOymfZ0TSptLCNdVT+3jKxfUS3MkI9WGJ9gATqPCbBthmM0ZWKBW3045DdQDaMqXCvS Kn/hn6qMgNwq2fQndZPkF+9ZCKDKV57FVi1fnKf4AONEse0/Lb0UHITyEbrJOpi5104F YMyHGXBRKPV33QtpMPgMKWZ9AQNtIrC3p7KmC9zHufO1FY94nXpt6FfnV3sFHICzWNiQ jtTeQ2BmHW3kbN5LPMPpEfEpfZSXM4vKp5cheKbE3M7Nj9hyzl1XApsTJZTsqYYDYn71 YMnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805690; x=1724410490; 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=Vjjz5PQxtXSt4zeT/RkSGh8NQkwY8peMKp36Eteyrx8=; b=IdZF8QPK8ECSI4gTB8IOfRHmmgdiA29YIZxPN8AlGVyay7eMngX6hDWlJCgL0xMi91 rImw4bq9HwfEkbqChtLPgFM/FBt3iEdmSXvlFVOlMRMtijHw/icfZ0Alrnut960hp6GD QNlk5NHK15m6bLo1V9nXT84f3EpK1pz8lmJm8FiZEAukypUOIpFQZRkiwFlms2yK173a BTogldAanCpgJl7mOdjbWwqI5DMXpRZfQevliashIon086YSfFmIBp88+2eHLbRhGljK s5ygkt1KsI46HzPmzUXcm8VrKswsXBxM88gtheBzwsHMu29BN1vsd3hL3n0VcWpM9MlC ilfA== X-Forwarded-Encrypted: i=1; AJvYcCW48occb+9oSzd5avLrDQHtEOrVFCIybCjUudd92Xf3z+eSTu79LiUc87CJxiWJz8mcGUlzRBNR2REogPPjpOJQrC7a/9XPLLJxg7Dpqe0UBFKSgK0= X-Gm-Message-State: AOJu0YwzC3N4aMJ7vFHAGWsH2M4E9/uX47N0wulyANnaEcP8T/5p8DTR 8FRwH2qC0seQ38scBpnbXpXPOfxXxmNpC0ppkZ0JVisF9zHp70yqv+CJUQfhats= X-Google-Smtp-Source: AGHT+IF98iCU21qh48ym9eALe83DFj+NaqQe0ww3kus6+d1nOigexYI9Bj36AT3UON4kRaajmBPYkA== X-Received: by 2002:a05:6512:b10:b0:52c:859c:91dd with SMTP id 2adb3069b0e04-5331c69592dmr1563994e87.5.1723805689671; Fri, 16 Aug 2024 03:54:49 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:54:49 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:27 +0200 Subject: [PATCH v2 03/13] memory: samsung: exynos5422-dmc: simplify dmc->dev usage MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-3-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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=6832; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=vlPrg74sTTRgZv6b3DWpJX4RlTR0m5zTMsyPufQEkhM=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/psDysJ5IZQg/Exa9zRiD8qS7v1C4oWjmAa +iF22nhqXyJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v6QAKCRDBN2bmhouD 19SRD/9Hhb+f4qcsW1fTUSeFE2GDuq4WG6xHi1qC4sA05BAgtLQw9EEnWYmjsx1rBvDZPVfUNKG X/SKAfHMcVSkpntMyL+q7y3b28SBYUAkR/eGFOXcgaR2yEvn/R0A4uVgSfWQeYhlv1IZVssV4BL P3utZVIRzMiF6bFcOdbDNnLBI8ROVgxm6d7Q4Dj9tySZU8efIMiT9UvMAlVUjd9NtZy5dGcdSgS NSPvTNVXiTv2Zern8yNwUPlbogkf/qvH9qZj1oA68fS7Eh0n18grGuxS2eOAvxhsrQ5aWiO1ITk Va0MrmaBq0d1KoRyu3WAwXSESmwNr+rKFT+S9Zf9xiWho8o3tumEi+eqdnpOPKn8PA3TLfRJqVo TD5rZwqPvYaYAlhafcbh5Vd5ZXsUXhHA9hUeNPaYWuRHZFo++Kwqkk32ZE0WliNX42nBWIt1wrJ 5UI0O3CT93wzQyoE7ZL4KSw+/xgvOs0+JkS68qR6zw3L+6ikGKUP5XT2mHZiZjfUc53IjHg1QjZ kzE8x9RiROA0xwLhEOgmuzmcyAtldA3XDc/Ift3Q9T7n6Ndcq8Eu2y2vrO2nejvebkVFDmdAB7o pp3kv7f2TiFlKGkHjkj3WB9dLwByWBYH/vU1b+QiZihk6Q0K4T9HBwvCrNM3xNjDANZkXTde50O kAxRJo+pBYUT3sw== 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-20240816_035452_015730_0DDF251E X-CRM114-Status: GOOD ( 16.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 Store 'dmc->dev' in local 'dev' variable, to make several pieces of code using it shorter and easier to read. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/samsung/exynos5422-dmc.c | 61 +++++++++++++++++---------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c index da7ecd921c72..48ef41b8eaa0 100644 --- a/drivers/memory/samsung/exynos5422-dmc.c +++ b/drivers/memory/samsung/exynos5422-dmc.c @@ -339,19 +339,20 @@ static int exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set) static int exynos5_init_freq_table(struct exynos5_dmc *dmc, struct devfreq_dev_profile *profile) { + struct device *dev = dmc->dev; int i, ret; int idx; unsigned long freq; - ret = devm_pm_opp_of_add_table(dmc->dev); + ret = devm_pm_opp_of_add_table(dev); if (ret < 0) { - dev_err(dmc->dev, "Failed to get OPP table\n"); + dev_err(dev, "Failed to get OPP table\n"); return ret; } - dmc->opp_count = dev_pm_opp_get_opp_count(dmc->dev); + dmc->opp_count = dev_pm_opp_get_opp_count(dev); - dmc->opp = devm_kmalloc_array(dmc->dev, dmc->opp_count, + dmc->opp = devm_kmalloc_array(dev, dmc->opp_count, sizeof(struct dmc_opp_table), GFP_KERNEL); if (!dmc->opp) return -ENOMEM; @@ -360,7 +361,7 @@ static int exynos5_init_freq_table(struct exynos5_dmc *dmc, for (i = 0, freq = ULONG_MAX; i < dmc->opp_count; i++, freq--) { struct dev_pm_opp *opp; - opp = dev_pm_opp_find_freq_floor(dmc->dev, &freq); + opp = dev_pm_opp_find_freq_floor(dev, &freq); if (IS_ERR(opp)) return PTR_ERR(opp); @@ -1175,49 +1176,50 @@ static int create_timings_aligned(struct exynos5_dmc *dmc, u32 *reg_timing_row, static int of_get_dram_timings(struct exynos5_dmc *dmc) { int ret = 0; + struct device *dev = dmc->dev; 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); + np_ddr = of_parse_phandle(dev->of_node, "device-handle", 0); if (!np_ddr) { - dev_warn(dmc->dev, "could not find 'device-handle' in DT\n"); + dev_warn(dev, "could not find 'device-handle' in DT\n"); return -EINVAL; } - dmc->timing_row = devm_kmalloc_array(dmc->dev, TIMING_COUNT, + dmc->timing_row = devm_kmalloc_array(dev, TIMING_COUNT, sizeof(u32), GFP_KERNEL); if (!dmc->timing_row) { ret = -ENOMEM; goto put_node; } - dmc->timing_data = devm_kmalloc_array(dmc->dev, TIMING_COUNT, + dmc->timing_data = devm_kmalloc_array(dev, TIMING_COUNT, sizeof(u32), GFP_KERNEL); if (!dmc->timing_data) { ret = -ENOMEM; goto put_node; } - dmc->timing_power = devm_kmalloc_array(dmc->dev, TIMING_COUNT, + dmc->timing_power = devm_kmalloc_array(dev, TIMING_COUNT, sizeof(u32), GFP_KERNEL); if (!dmc->timing_power) { ret = -ENOMEM; goto put_node; } - dmc->timings = of_lpddr3_get_ddr_timings(np_ddr, dmc->dev, + dmc->timings = of_lpddr3_get_ddr_timings(np_ddr, dev, DDR_TYPE_LPDDR3, &dmc->timings_arr_size); if (!dmc->timings) { - dev_warn(dmc->dev, "could not get timings from DT\n"); + dev_warn(dev, "could not get timings from DT\n"); ret = -EINVAL; goto put_node; } - dmc->min_tck = of_lpddr3_get_min_tck(np_ddr, dmc->dev); + dmc->min_tck = of_lpddr3_get_min_tck(np_ddr, dev); if (!dmc->min_tck) { - dev_warn(dmc->dev, "could not get tck from DT\n"); + dev_warn(dev, "could not get tck from DT\n"); ret = -EINVAL; goto put_node; } @@ -1254,34 +1256,34 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) static int exynos5_dmc_init_clks(struct exynos5_dmc *dmc) { int ret; + struct device *dev = dmc->dev; unsigned long target_volt = 0; unsigned long target_rate = 0; unsigned int tmp; - dmc->fout_spll = devm_clk_get(dmc->dev, "fout_spll"); + dmc->fout_spll = devm_clk_get(dev, "fout_spll"); if (IS_ERR(dmc->fout_spll)) return PTR_ERR(dmc->fout_spll); - dmc->fout_bpll = devm_clk_get(dmc->dev, "fout_bpll"); + dmc->fout_bpll = devm_clk_get(dev, "fout_bpll"); if (IS_ERR(dmc->fout_bpll)) return PTR_ERR(dmc->fout_bpll); - dmc->mout_mclk_cdrex = devm_clk_get(dmc->dev, "mout_mclk_cdrex"); + dmc->mout_mclk_cdrex = devm_clk_get(dev, "mout_mclk_cdrex"); if (IS_ERR(dmc->mout_mclk_cdrex)) return PTR_ERR(dmc->mout_mclk_cdrex); - dmc->mout_bpll = devm_clk_get(dmc->dev, "mout_bpll"); + dmc->mout_bpll = devm_clk_get(dev, "mout_bpll"); if (IS_ERR(dmc->mout_bpll)) return PTR_ERR(dmc->mout_bpll); - dmc->mout_mx_mspll_ccore = devm_clk_get(dmc->dev, - "mout_mx_mspll_ccore"); + dmc->mout_mx_mspll_ccore = devm_clk_get(dev, "mout_mx_mspll_ccore"); if (IS_ERR(dmc->mout_mx_mspll_ccore)) return PTR_ERR(dmc->mout_mx_mspll_ccore); - dmc->mout_spll = devm_clk_get(dmc->dev, "ff_dout_spll2"); + dmc->mout_spll = devm_clk_get(dev, "ff_dout_spll2"); if (IS_ERR(dmc->mout_spll)) { - dmc->mout_spll = devm_clk_get(dmc->dev, "mout_sclk_spll"); + dmc->mout_spll = devm_clk_get(dev, "mout_sclk_spll"); if (IS_ERR(dmc->mout_spll)) return PTR_ERR(dmc->mout_spll); } @@ -1329,38 +1331,37 @@ static int exynos5_dmc_init_clks(struct exynos5_dmc *dmc) */ static int exynos5_performance_counters_init(struct exynos5_dmc *dmc) { + struct device *dev = dmc->dev; int ret, i; - dmc->num_counters = devfreq_event_get_edev_count(dmc->dev, - "devfreq-events"); + dmc->num_counters = devfreq_event_get_edev_count(dev, "devfreq-events"); if (dmc->num_counters < 0) { - dev_err(dmc->dev, "could not get devfreq-event counters\n"); + dev_err(dev, "could not get devfreq-event counters\n"); return dmc->num_counters; } - dmc->counter = devm_kcalloc(dmc->dev, dmc->num_counters, + dmc->counter = devm_kcalloc(dev, dmc->num_counters, sizeof(*dmc->counter), GFP_KERNEL); if (!dmc->counter) return -ENOMEM; for (i = 0; i < dmc->num_counters; i++) { dmc->counter[i] = - devfreq_event_get_edev_by_phandle(dmc->dev, - "devfreq-events", i); + devfreq_event_get_edev_by_phandle(dev, "devfreq-events", i); if (IS_ERR_OR_NULL(dmc->counter[i])) return -EPROBE_DEFER; } ret = exynos5_counters_enable_edev(dmc); if (ret < 0) { - dev_err(dmc->dev, "could not enable event counter\n"); + dev_err(dev, "could not enable event counter\n"); return ret; } ret = exynos5_counters_set_event(dmc); if (ret < 0) { exynos5_counters_disable_edev(dmc); - dev_err(dmc->dev, "could not set event counter\n"); + dev_err(dev, "could not set event counter\n"); return ret; } From patchwork Fri Aug 16 10:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765941 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 C3FF9C531DC for ; Fri, 16 Aug 2024 10:58:19 +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=ps5OVwPQda0LMKMNWr2tdKZsG2I+Nc7kykB2orG3PFk=; b=DgIJlWtY49DjI2gmbXNjPes1Rs eEzVDln118QP2ng8wLqZ99rYooN4jFfWBRw2UzXeRe1GN1d3ytW9sDlh8PQ6fwRn0AcncXPBExgUv dXtZv4ivVyPbuoV7iGhn8CPWuHWbQvAQ+Qr0bVUqYDeI7VQbvCpR515tCllsygVcpPPpD/Nca17G0 LKlO61XIFx2goqBf47cSHLN+VwRX9W9OgzTVD/KEbag0Qlm2b2IODE3qfBaEAA0XcK7Ait5YW0//N nu74W2aH1Nn1YWNhIYPeIijsLS5ZzOOt7GsCqwx4N4Do0OPWiY4fNKYLPiKy4qYlehJDUgeWos/Ie 986LsC1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seuel-0000000CezA-1Geh; Fri, 16 Aug 2024 10:58:07 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubd-0000000Ce0m-1wN3 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:54:54 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-428085a3ad1so14368015e9.1 for ; Fri, 16 Aug 2024 03:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805691; x=1724410491; 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=ps5OVwPQda0LMKMNWr2tdKZsG2I+Nc7kykB2orG3PFk=; b=B9rSxfj+6aXPPhwE3mIpjl6ALfjY3G0SXV06XqcBl6jxrDs1+ByLK/aJ0UBnEdXg7/ A1fFBBNN6yV/Hec2NqH+HJ/6t6yYdwh7ydNwumVkKwRzq8EsqZo0F4Ct8kUbNBu9UWCA asbAxHnZDD/wv9l41m4Fsu8epIzwSIOO3SxHVYA78ih2iD1JHxQjVCUY9IAqJyR+yLfR 960/4oFZDJ6PNHm9p0HMu4e6y8bnWew2xG0yt42EZlDIGrBxfVz3xnp3Xuu0pz7gVUYO 7b03mU11HRSPXQEwjBbxcqtdUQpR3XBQChKJvdqNVsOBy32iCLDpGRmUgOZo+u4unIth Lkrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805691; x=1724410491; 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=ps5OVwPQda0LMKMNWr2tdKZsG2I+Nc7kykB2orG3PFk=; b=Ra0/ARaSxJUMjyF5yzZV1wSMciYGWKrtkVfVQ6LTkXBTx4aH4zGh7K+0bwOZxV1U52 EHVrmRz+1RWN2FtHAyrPD32BMiGnO3drJeQQT9IApRo59KT6z49hWu9+1dwrgKdU/LMD UtRArca4JpfvxNOg+PevrFvtW/7sZtXoWHbvC6dGdFKOJmXaumXS3NMdSAxt0YMkiCGt G6QrGkjdmGU2z53sQRwHzj7YlQ7zJGkfCUCrf490UofU9HSCxu9m1Xn5+eHWiARBKX4+ ro2ENnZUjlUVTy7uVurAVUr3Y8PvaJL3Ou9nObQHuHEqtXDcAWCuivC4FPOuf5THx61q 4huw== X-Forwarded-Encrypted: i=1; AJvYcCUgz7RIBKpUrXzi6AfSFqpRuHFI4NYrcRgUQ4y1GJN9ZF24xPdnKdN3dTTMWTEUD6opWaRDvX31Li1eJKgGtR0y4BEPlNXSH42qoaTNE7jqn2B/o/I= X-Gm-Message-State: AOJu0YzsGeYd/4c6YV2RKvxVLlG8GLwi7XPRf1c+7v23qsG/V3XzM06f 7LhoZU56t48fYu5t32QrsVqbPonHgaQKY8EYXDr49sSxstEj/dhEAcZoLXFMuCY= X-Google-Smtp-Source: AGHT+IHxdhvK1ECKqUfwiSpYS/cvX8viRntSwBf6ySKhzTK46bfJHN/AjQbBdfp89HO0dgJRuKS1sA== X-Received: by 2002:a05:600c:4e8c:b0:426:6ed2:6130 with SMTP id 5b1f17b1804b1-429ed79d9d6mr15821505e9.14.1723805691544; Fri, 16 Aug 2024 03:54:51 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:54:51 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:28 +0200 Subject: [PATCH v2 04/13] memory: samsung: exynos5422-dmc: use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-4-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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, Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2879; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=aOG0FNkWr7wWqxbaC9hbRdBtAW+4DKmOSIujr3Va07A=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/qic+gJt3V9XC+/wcsbOscwI6XAJiI5CIZ0 cpgP5XqjV6JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v6gAKCRDBN2bmhouD 1x5hD/949WpMkITwA7QhSsLEYr1aaqTVr+5IEE6h37JucIjQbSTWkGgK4m/wf3YQv8/aUa+1Swx hc3s4GGsYlwauOMNbRde2juds7Grplj5jSnR1lazEcz8YNZqV7tHdU5X6SCzFwiEacMwYyaIvLf e0hh9aN4lUSN00pQs7bioG3RP2muok3RivVx1DJSgRADr4zt36pXwWpX55dGUCVW5E/Kw0LCfvC CoKTtOojcKBWbyzj4NWXYjmogE5RfcYSKDc3SQsy7aFMlkw9P593FVbHNYB74NbU72eJSvNNwGA 7+PMvNWtHxR1i7ri1Mht8Bq2PIKlWZIz4pC8JSdyTY++hvWyo+/xpNIgcvomfls33V0CG1t2fgQ GPd+q+U208qLx/yp4THm/GReEuAQYLpGUwXF959Yl52Kytcqc94QW1QaTIYeMPQpU6J5b8cQi4L /ImmAa+9xuVkX9Tx6IqRXfpbbzwE5RSXP0R+SX4hqxWxQ0Vc0qJGW7yxpQs3O4XIxHxRxo27xan BNDOdFigoQxxzPBwdnhM3wiSsAzztF1+d6tXYUlsdwt2+K9N7iFvlOBBjJPtMGTE5nSZAc8K45t daUn0t1W965yCXgeSR/uDoPi6XSGhNLJ1aVOLyixXuIjkPiiTFpmZaW+j7tGB+oZqF5G0K/iO7O ajmcbr4B7MWf2kA== 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-20240816_035453_552467_959C3728 X-CRM114-Status: GOOD ( 15.06 ) 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. Reviewed-by: Jonathan Cameron Signed-off-by: Krzysztof Kozlowski --- Changes in v2: 1. Wrap line before of_parse_phandle() --- 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 48ef41b8eaa0..7d80322754fa 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 @@ -1178,10 +1179,10 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) int ret = 0; struct device *dev = dmc->dev; int idx; - struct device_node *np_ddr; u32 freq_mhz, clk_period_ps; - np_ddr = of_parse_phandle(dev->of_node, "device-handle", 0); + struct device_node *np_ddr __free(device_node) = + of_parse_phandle(dev->of_node, "device-handle", 0); if (!np_ddr) { dev_warn(dev, "could not find 'device-handle' in DT\n"); return -EINVAL; @@ -1189,39 +1190,31 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) dmc->timing_row = devm_kmalloc_array(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(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(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, dev, DDR_TYPE_LPDDR3, &dmc->timings_arr_size); if (!dmc->timings) { dev_warn(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, dev); if (!dmc->min_tck) { dev_warn(dev, "could not get tck from DT\n"); - ret = -EINVAL; - goto put_node; + return -EINVAL; } /* Sorted array of OPPs with frequency ascending */ @@ -1241,8 +1234,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 Fri Aug 16 10:54:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765942 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 391BCC3DA4A for ; Fri, 16 Aug 2024 10:58:55 +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=7xWelpTr/XRUqKFM91cNQuNNebnp+T2/XDk25EhyUnU=; b=owEMPxr6b2JR/cQIOMxCfITBQF cdv39JcLAXpv1IE52GegSMmwa/O3yDmjNBfrMdkscfjJrU8RtZ462Q7t2L5vos30pOQK9D9zD8GHi wF9OBxC8OUG38gBh8Ppeg5Nhvql9CUI0k/tvEZp6a1/fkohunJvUY1Woojspm+s3K14j5GRndtroP PlVhs792/6zpF9lRnN8pJrZoIlPEIZX6407UAh3ZL/3kTnmx6c//bPUY4x+EePDEtmLqxfDVEWuGA 7e8ur0uD/w9IcUeQaZrv1IqodNjazoGu1KTKafOenXVayqrIwHh3b0xIsQB1OvubR0sjX1iL6YfW3 bJJaMPyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seufO-0000000CfAT-0asY; Fri, 16 Aug 2024 10:58:46 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seube-0000000Ce1P-3Gjy for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:54:56 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4281d812d3eso18463425e9.3 for ; Fri, 16 Aug 2024 03:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805693; x=1724410493; 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=7xWelpTr/XRUqKFM91cNQuNNebnp+T2/XDk25EhyUnU=; b=fEnLatcxwVQa2E0Rv7ExES4f0YgO6mMHBn5Hrh/PL5B/5k0o/n6OGlgyZihs345ZBx +fPkQtMbgRtLCvRcy5HtrWIbx5wGaIDkhoUNEwT3P6JoSvYTdQl7XQoaSOJd2DIz3R0o 1dc/daWL+1qDDnxC7UXOYROoibnXTdu8sNPnE19gg0we/He98h0X6Pq0p6fzIovFqaZP rzVwCWXZ2XP+03Rv+kxVKGwNjdtoiw59u01yYyj1Amo8iKOdkfW9odJen3JUbdbmsqDo 9ShY3bTnVlzjFcJRYGgMXnsvgM3kCHXylweoeHsP9zJFjCbgpiRPV2kGRT5ha5HauxgR tjOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805693; x=1724410493; 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=7xWelpTr/XRUqKFM91cNQuNNebnp+T2/XDk25EhyUnU=; b=TWNPbbYE05LCj2guCRwmg6O4m70Jufq7Qevn57MdeQIn6ucvFbNKHOLwHqrQSDIVbC n2MQ2T/g3bY8Zoh0vqwttIPidQv0N64Asud5gi48eTup8EVT4+PnQnS+tJpfqRdR/0PE 35eqX44uw+qAP6tJIXvrBWx8AioVBoeSfIUsz/iLrotsfqAcPuEXeWM1yI3DHJz7Go+s pMF+47ArxZvF7nNdFL5aqWCg93+XpC/2uHatplJ7Esmb2zTePAc08jDg8wUL9i0oUE4H ZXVmCMeM3EFh3DSqS18JhFiRw0qdmTthFvsWdkUWKzffCmlE45A8tv+Mc4ZuPhj7Qesr /ISw== X-Forwarded-Encrypted: i=1; AJvYcCV5RtFSyauKwAPqK/KarOdFw1XMJnUoj1CUPJ+JuxKvydpvVO1FAxW37wlX0b/YTjvUYskk1XQo7Ub/f3zRA5w1@lists.infradead.org X-Gm-Message-State: AOJu0YyU92zkhHGvlHIE45zOxYUQhptldjCkCzAnSQjbQK9KdiIUJcxM uDDMge2Jln5ZmNPG+C5KTeAGre+uOVgu09xGqd0hWvJ1M5J45C+1eQhxdu0OK5Q= X-Google-Smtp-Source: AGHT+IHD6wj7Dw8hXlamLzfXLE0YX9yxmT0kZMl6frJAfF1JNE4GaKBDulB0vb8SdWVJZ+hZ4bUsCA== X-Received: by 2002:a05:6000:1368:b0:368:6f64:307c with SMTP id ffacd0b85a97d-371943285e6mr2028271f8f.15.1723805693032; Fri, 16 Aug 2024 03:54:53 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:54:52 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:29 +0200 Subject: [PATCH v2 05/13] memory: stm32-fmc2-ebi: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-5-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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, Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1947; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=G2yPrpxBXb4PKw54ECzRtlVki76Ov9GcRLuKMdvmvH8=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/rb4znf7Gc13+IjmByAMk6RS/9zPzPfxYqw 7Z6nvJ1sLGJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v6wAKCRDBN2bmhouD 18MYD/oCLaJmWOWxy5n36CttxJFqbO51zWjtlcst6hRwuUgHToAatzCC4rqdYj6BqW6udSiOq2x MaCjbbXPxz3iOpxzfwcKWbg19No+lmlb1qk/33S3x0U9G2QJPvwticKeSkQ8rVKoCQ0axG/Jk64 d59f87Oj+o4vvSe7bsarfpHSoxwEgjUVHG5/GvzVue/zwwfqsjCGsyd4eXS+7TCNWhyCIn5arMy d8Na9fDtC0X96Vjb5Pz/N289yVyYzZMtPrRDhdCQf0mxVKutUKhovg+VIGQwfBYJn8zh/ZGk66X DnuFEXvtDvlbr3h9lprlTzxCx/NRlVE/inFAV0lmj0GkErB0jire5a0G8+2/TMBDPuOTQu67sWA AZbrnvBUiv4vNpo9dtFviLw8KmYvUiZQ9VJCtwrVDwAYjtaKvWwu5pUiODcp98nbefbrm3pI2Rd THvcNlzPdoge696l78CgQUFoI5nxUVT8pPm4jjf82IsTJTWP2SWRg6NIldGL9doI71w+PQe6u+I dn4MAXawWNYuqEYgnvKY6sKASV82gYBZRe+W8jWBdobXx46WliBPxQqeY5WU5WaZe8OQpG7haL8 DtnPg9H5b0Fdv+igpVtGJ1c7G6tDzTSUiatX/wgxRi1EO61LToCYLGG6PmXswqAUADLuNbXmpWd 5flfqJkZrR5Iblg== 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-20240816_035454_919639_A3FD2C3E X-CRM114-Status: GOOD ( 11.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. Reviewed-by: Jonathan Cameron Signed-off-by: Krzysztof Kozlowski --- 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 Fri Aug 16 10:54:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765943 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 54C75C531DC for ; Fri, 16 Aug 2024 10:59:40 +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=n3JBsocw3Kxo+E25kYGT4nJEc4iHDY8+0T+RDH3CrwQ=; b=3IAYod0oflJXbYC0bTtTgQaPQZ E1XpbyMGYTtjJKWVqpJJn9V48JfkvMlXVctwR3nPP8m68WveG2deCCIeyPJnrCoH+hjlmktJH5N6f kAGOkjd4cT4RgnrQDGBflRrXUGUDSgOuQy73XEnSmaRLz4XwwzbhjDuoyHIbfHveGe8aZVL+ShKwF 5ymFZGClLAl0uVDXQtElTEuDZpOlodeqzvY94ivd5r/urou9HQiU0O7c51lBEhWuA0KRoO+WnyOaO nOAxtEX2b3dqiZXxqDVdGn0FdAqtcefojbhGouUJgCqz34dTSI59Zi/WfkfbH0Olt37GlYoi8e7hO hpj98KZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seug3-0000000CfQP-3pSr; Fri, 16 Aug 2024 10:59:27 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubg-0000000Ce24-0HRi for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:54:57 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42812945633so14445195e9.0 for ; Fri, 16 Aug 2024 03:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805695; x=1724410495; 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=n3JBsocw3Kxo+E25kYGT4nJEc4iHDY8+0T+RDH3CrwQ=; b=woqwAYLVFZZVXoOtPdZ++2yBdDapmbF4/xI264xriGxBIRYE/eKrFpjpaF9YTeZzBB PRuH1iKaSgvvEov/xnBwOK2mzDVZeLUYFb7gJ3QGSrbBU6LtxCDfc6awRieoxqLjsxVM Q0P7v3CS2yBtIe40kFlhzx/QOVEepQ6EUiERSl8taTrWiPGcQSuOBBP+WY7jRUoMPodp WQKFpSLwhE+DUuBOElS6OfK2GSSQ9OEbQ+01A8k8oAsUOifXAe3ANaExvExo+M2impD/ fASDXA91tWDXhYfM2WY2MiWDh6PLxUIY2isY3c6g3FVlv5vas0FRnugANzoK/gkz9RrH 1IfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805695; x=1724410495; 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=n3JBsocw3Kxo+E25kYGT4nJEc4iHDY8+0T+RDH3CrwQ=; b=tKc73CpIMpFfmaEcRKsjtmY18mcug1fOT4brsq5b3bFuEw54NvqZciqwCq8mAKxOOb imFX7FzEwRVB6P5+BLhTuWVNT5j/RZSkITRrM83rKFWaq3Ppe4bXNHul1teIxKdrnsxW rR38AWz8OIoGf7XjYVGnAhv6OeT/yg97XUwJQOo2+XXVs44yVgcS6wH/DZMnmCf+EpWw 503J7Dd3AyScmeIQHvM7IjwLhrShXB38+RaVdlVsHcZYBw5GyB5wWAVwYoTDGJydefVA VeiFDPgqjh3qlaKZkk0l7YFIpwidMDiRPoBoAhSz46oNDqHWv9CsKhI3PtRYMIMwFD58 6EeA== X-Forwarded-Encrypted: i=1; AJvYcCWyFNRMAQukmD6ro03Uaxse/nGMa1ziIJ7ga/lu+RR97yXA7j/yhqz1jJFBMjqeXtKP6T8n2vqb+r8dW9SiyG4J4iWSf3cGbJkBQfnU8u1rgY8lTE0= X-Gm-Message-State: AOJu0YwW8QV1ti5aqO1uxXbHiv1gnJgN5l6eS1X1rU1Cir331QMPSA2k Smu3fNaxfoeYs1v3/9EzFx22v2PZWpb9LcRqKXsJCeN3gNrnwBlMPKXXt7z01kY= X-Google-Smtp-Source: AGHT+IGn24wROLCo//DeF9Mt4n5RqsRN4gzOTX6eoavLir3z179fbxoYWt2i3lJKrmfKXQrfoXgzyA== X-Received: by 2002:a05:600c:5253:b0:426:5b51:109d with SMTP id 5b1f17b1804b1-429ed7db6cdmr13568165e9.36.1723805694621; Fri, 16 Aug 2024 03:54:54 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:54:54 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:30 +0200 Subject: [PATCH v2 06/13] memory: stm32-fmc2-ebi: simplify with dev_err_probe() MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-6-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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, Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1560; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=wJWap3GNtDgLkBsWgnZ2oGeVybItqtjwJfBbYGyPlo8=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/sa1xUY2YBbxWKQP1tRrbI7EqugouDoNZVC Bxnkk/Q3qWJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v7AAKCRDBN2bmhouD 14EjD/428b1j5rsiaZx68rdq6FjyH4n1esOcsNDQiNVBlR4beEtg6pbk2K+emMl87pLVexTc2tI Es+y1tj551HtjBN3PqK3+JqBC0trcXcilAiFzYScxywj6dzEmrD1gpMVj95qyaJSZQbemKTA+TY MKvjLPhQtIsoaNEOUWXyVoK4Q88HdIW6ZzKjEwnTi9cHljpxbOjpA6q5q3IT2pyzYTbzVHQzNpZ +3kg/GACYNB44ceLVjoCzujsdHfWY2VeIsO33kZMG3MYwjU7YqnCTUZsFOnSbvON74kB7tBW+i0 HEWc9aH75+TQIRz/axO9yk/PymB31x5t/ClfslDUwoGvMui9XnVf4CF8XIk/3xjbykNxLXfrkJb DVpJvmhiHvF4+W1UZy6tEvIqvzJHMCogCGapsN8DsaPdCmDx5ipOy9RnxZ7PRKaU23KHA/9w/3w m5M14ycC5TG0e9cb9VoQaYKRftqHMIDDyUIHXXeC9IZuOCSPY9hyAxKvOLgpXL7itZU902JzVPy ZLT6/DluBzcv2jZTniQ20gHFVZzIvl14HMXmTlgYBJCruFV68W5nndXMCA84RyMLPHbNhTo1S0p YEllo27Ct2QdtJtan8MTc6dSbIgQ5UWchNtS38wgjjg9qRV9k1N3ZPaU+XRyViDL6FnJumJl+yC Xtov6VwsVHfu4Nw== 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-20240816_035456_214185_990ED887 X-CRM114-Status: GOOD ( 11.92 ) 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 dev_err_probe() combines 'return' and error code printing, thus code is a bit simpler, even if it cannot actually defer. Suggested-by: Jonathan Cameron Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- Changes in v2: 1. New patch --- drivers/memory/stm32-fmc2-ebi.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/memory/stm32-fmc2-ebi.c b/drivers/memory/stm32-fmc2-ebi.c index 7167e1da56d3..566c225f71c0 100644 --- a/drivers/memory/stm32-fmc2-ebi.c +++ b/drivers/memory/stm32-fmc2-ebi.c @@ -1579,11 +1579,8 @@ static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) 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); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "could not retrieve reg property\n"); if (bank >= FMC2_MAX_BANKS) { dev_err(dev, "invalid reg value: %d\n", bank); @@ -1605,11 +1602,9 @@ static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) if (bank < FMC2_MAX_EBI_CE) { ret = stm32_fmc2_ebi_setup_cs(ebi, child, bank); - if (ret) { - dev_err(dev, "setup chip select %d failed: %d\n", - bank, ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, + "setup chip select %d failed\n", bank); } ebi->bank_assigned |= BIT(bank); From patchwork Fri Aug 16 10:54:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765944 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 3DF22C531DC for ; Fri, 16 Aug 2024 11:00:19 +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=6YRde/fYbJz8xZyUhMQmHjg4wnmznu+US4KTcpFxBxo=; b=4/NsRtGz33U+Kv0PHl1ybb4Dlc aHNy9SL8emjDQUBw2oIU22I3NcYygg+eAuGTRNfe1bbB7YeR9ATqxssrueXT/9pCKZ2B22Xoy+z0w IAhSUJAzm9Y/C2yF22OJsZq+TpRGQbsiz0rqkkFcJ2zQC08HicZZ7slHYno+zXX8Cv+Hkb1zocE3d B/VJAQlZ1EdWs9YWOW+SiMgQD9qTFSAinU5h/1b4FU0UuthlNA8qX82hpZ9w0YJ/SSvoiOfn2/ViO YWWw9te+RXhdGIx4omkwaWXmtRf3pzkfRebAlHd3Hh03F8kX+9RaSZ9gp2MkBIMZcETkwZFexyxda N4Z/XLeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seugh-0000000CfeD-49Kx; Fri, 16 Aug 2024 11:00:07 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubh-0000000Ce2c-3S6y for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:54:59 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-428101fa30aso13205005e9.3 for ; Fri, 16 Aug 2024 03:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805696; x=1724410496; 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=6YRde/fYbJz8xZyUhMQmHjg4wnmznu+US4KTcpFxBxo=; b=l6e27z2gR9Vut9wJwRurV2AhkoR6F9a7G56YlTBwJjuJOWc1MLCKT5wtKcbqb+mX6h NHDVMC96BuPEvldLSVveRW4iUetRa3pNWKRwHk2Ju3wBsaUFMVKe4IIbMi1r4mfhB36K /tWPBysJl2bbYSIi46tWCEY6gR14zHL1QBX0p1uq3ugrHjQ87qKFvYA4oqOYFvUmqJcw Xy77KxJOREqpAQt+Ng+kRLudm4eHch//rhphm5OFuDTDtMOjerD/x/Y6eCZ1ZVonZbEh cLTgCd+k5yzkhE9QxSil3yAHty2YfZSdbjcYGlCDly7vi18RcFVNkhDnvsrLv1MSpAim ezpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805696; x=1724410496; 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=6YRde/fYbJz8xZyUhMQmHjg4wnmznu+US4KTcpFxBxo=; b=C0c+hV1SEdEQyoMdrLvmcypHUaBlpYD+utmD85meFf6WupnyvfiAliVXn1Qf8UyYkU qshz/S7OxIJ4s1JaAsA3cnnaSjYmU9j+VO11C0sDtd6zezo+ZfWGUm3hO6MBsAda5a1X Uze/AWSj/ngpNiXOwgYI16mDFe45DrPn5piwnW6zfqjUeMrmPu6ubCooXjyD4yMid1b+ z/TCABm/TngzJ56ahePoa/BAy1stllWovt5Q0Z3jpGc65bpuvupaEPlq7W9Squ9Luz5a BHNLRYOfj8N3QAnyg/2L8sB1HP2o/kc9X39HeVLF7qSD3suRHoVVHFGRCLv0Bv4tRxRo dUAw== X-Forwarded-Encrypted: i=1; AJvYcCUtn+qoRMSZlOLnkISc8sDL9hsvdItpbhv7nQOD/we9yRBEmTN/IbKoFrKIkUJNcN8HLIZLzsNIEg7jZLy+TsC+@lists.infradead.org X-Gm-Message-State: AOJu0Yy+tyGBzvjsnISxbIX60oqWWt0PHQWhX1O9piQkWuBDPFkDH1Lx J3sbyevwqOA2KBoVKJ9ZrNFhoFWDBTVnyNnznqiRyNCxUZUh1Im5DpQuY8XGmLM= X-Google-Smtp-Source: AGHT+IF6JR5QgFzYZqDis0yng6ewdCGRElyq9KQSPO+EpQI/aW4zcsFVDjGZ6uVazhi1rffyYnq0KQ== X-Received: by 2002:a05:600c:4f8d:b0:427:d713:a5d3 with SMTP id 5b1f17b1804b1-429ed79daa4mr16802255e9.11.1723805696134; Fri, 16 Aug 2024 03:54:56 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:54:55 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:31 +0200 Subject: [PATCH v2 07/13] memory: tegra-mc: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-7-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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, Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1905; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=SAst7T1lfs852WDMPyN7cdI8dxlvyoFUdcgyCbTBwGY=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/slbj3+EXAI6pk399+GoDZQ7kgdWtQ7XQ9i iI781jL8UuJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v7AAKCRDBN2bmhouD 10ZTD/0Z7SRvLmaBE+Gm6YtZvr0IwKzMR9efFrxg+sCxIUabM6l8TKG73/GeZE1pWa2NzX5Y5MT B+MgKAT7I93N042qHHUfGjB4ZNqu3HoHMBrDTFFoixqjMeJ3em7cZuCi84Crr1chTAqvyqQdZK9 idnbYS4yHD6T/VcXQ/6OhgyMuf1OfyghFcekCQGQQB3ifinxb9Sx6u81HbboWBwlCLU1vAOMCya l/8TUj7AzauBbQOT8cHxiVmydvVG+QivUVINIkENi6eWcdAPRl4qBYanLQTckl0s3HOeKO8rSjg VwvimtJXbPTRswVDhrO3r+Q5KlgN0Q/03mPM3GRPRCYBfZ5Q+M2NOGrc1pmHMmkC/IJjO6D6fmr P2s9hAJHAvHYlucn5l7uV2zqb5UB1s/MIW8Fh0ZTuSFFo/HzH7MFBXdYgQSagiLYliwLeVLbsoe vloGmpxWk4IvfxapJl3a5beo99W8PALAYRwiMTl9C9yU3ysvJ3l16kMkCQAsIB6fB07zi25a7AF 5lyltwEAXdORJvYfV2qpH0ubioiMFhxVu/lTr4N9gd8r2F6HEj4aNZKhFhfk4KpWypXInpaW3BD rkFiaKUi14wboHIU0trpU3cNYvV66uyuLxMKTEGykTQ7eihutPKJyUtr1HdprrvuO4dl9aNcMU1 aV0RVoW1QBvtjIw== 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-20240816_035457_912204_774AD29B X-CRM114-Status: GOOD ( 12.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_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Reviewed-by: Jonathan Cameron Signed-off-by: Krzysztof Kozlowski Acked-by: Thierry Reding --- 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 Fri Aug 16 10:54:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765945 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 253DFC3DA4A for ; Fri, 16 Aug 2024 11:01:02 +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=JOgxzZUvrtpq2BMDuicgWPsp2jimj6KEDspxwy4BQUg=; b=AphfnF8Pjjl+Ws+3we2ZsIb0gA p5QniLd7O7ZtMYHmOw0dPi0uDjxyTAC4ja1nVcfDJfGjLuhit+qMqVKu023sa1AW10q/wQKAFFmOE 6TrW4mm0+mcdxxwv1L/o/nBPnojOchIjw5SwU/g1Df8lCiGEBgKYhD10AFaorH5Q4HCdA4Xu2VL6U LHZKXmph9LNKajUEbWl3aQW6n/0r9CytTFuQxKpAZ4LN8DJeAhO8zocRK8XurZT/G8xxSDHNfn1+0 0xiUN3j8Ix9V4G1kaQYGH77cgJkjN7g6FHQFCbCYaTO0EY7AmnlD0IlSGL6fyaSCBSX/LDZjpPaOD pmnXlGlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seuhL-0000000Cfpr-3UIS; Fri, 16 Aug 2024 11:00:47 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubj-0000000Ce3D-0QSe for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:55:00 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-429ec9f2155so7322535e9.2 for ; Fri, 16 Aug 2024 03:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805698; x=1724410498; 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=JOgxzZUvrtpq2BMDuicgWPsp2jimj6KEDspxwy4BQUg=; b=o1Cy7p0FoWpWyQmOf+1r7HJOnK5YskFHWbT9QW6nXuUoB5qIT9aRvSeMqImT9yhTVN TGt60BuLmtn2jqM6htiy7bTkaH6NNAwb8SeyvFL2f7agOXzVTXlIJLfQCu+4hoAm/2VE Q/H2p/AwYUs//1MLpu0SzfGqDURcgzp578eimPVqaAnwF+ayQSSRaFxfaExDyeAISZXI EsA0ygs9ulbHNoqDKebkkYSMpwDzQHv9jrt4Itcp0VKhttXkO7GTpl58bczKFJXnhl7Y ZqM1/T4ahWAJrUe682V7pmsGJTLnhS+KHksdXzB0rXMGXXUvL49CqOF958SJeQgghnfZ DKEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805698; x=1724410498; 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=JOgxzZUvrtpq2BMDuicgWPsp2jimj6KEDspxwy4BQUg=; b=L1u+xMwvMUK1EUq2qep0Ww5aigergNto3NJL+iP58qoHY0St5DjBJNu3KZrF10X4nH S+dI2eC30trqsQhz1VZJU3+1Y1sb+CsIeYyl/7fvAksjX1dkjKGGy9O/JNSRaGkI8hqN 8Tw7ezeFkBdyov5rfbssX8JAFYSY87dsoLRwCjc8eIymPw+Mjv6oNOG38dt66pinB1MI vCu4m/PvHXC7isbW7lFolCNBaBmTBrl32HUi/RRa6++Xp6v8jlaHfjrSSmThVNDSFxVZ bCy9unnn5muszkDNPFExAx+bA3YN6RnrS9x41qoyIBvrQ1fVS8f5SS8viV/5I7f1CSQ9 Tf6Q== X-Forwarded-Encrypted: i=1; AJvYcCVZaeKSyyFcx3wt6m8ezuHo+jQPQwOiK/SZ53W+vbZ4lEvW6rGe56qp9q6Nakeb8Ea4VUtWZtt7o4RcdOTvLPzxqDRJ5BMKUGHs4YkQ/G5jDBnGV8s= X-Gm-Message-State: AOJu0YzK3eFlWa5kNuaK5eD0N3SsgwFmx3MqWAd2LNB7T4kuKQqMmpvS kBH4keLBQk+8MqzuOU7OTsjXa4c6CNoOTM1isAlDCBAgXLn2mxaVkApbK/InafI= X-Google-Smtp-Source: AGHT+IHMPxUtjfGRn7ZG1qPQZ/Tx/a2kVQMSOXnBcUVsMZ+mh2g/UkrF5oZy92ASETKVrsM2pu1Eew== X-Received: by 2002:a05:600c:a45:b0:426:6edb:7e14 with SMTP id 5b1f17b1804b1-429ed7d34fdmr15301545e9.35.1723805697665; Fri, 16 Aug 2024 03:54:57 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:54:57 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:32 +0200 Subject: [PATCH v2 08/13] memory: tegra124-emc: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-8-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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, Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1307; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=rDsZLo3wwoaidFkJYFptVSgVV4IV53Wsuj2KZiIUK6I=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/tahceV7TKEor8UTYOHOw8XO+MpwcWse5dr Yc5OT5M1QeJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v7QAKCRDBN2bmhouD 15qVD/4temSVQ0ngkzMHbEIkNQhXO194h+2fYYACqxi8kpkiZBvmRpBRXJviVipghRhO9K5i3Pi bCLujgzzk3lAnUlRAUWLFE1ZwJwbNorN3L2wMvDiAH4xWtexjXHdpJU6Frbq9hf41oMf8To3yn4 mpYNezq1J3BvH5AvfuNV2cG707DvNk/mGOfYyG6818en+8wWeI8gQFsjusd7PtdWmnq7fSRVcE2 qQnN3nCq4uBAvghWHM9zN7GmmkLtIP2jAC02NIDPVBw9QNZHaSjGb+Z9DeasEOErDeYzxS7cu2e /4AZKgZkHgu3Wa9veJOuUOYhwlovzdflxQo1yd725cwJs0PVSUmX5wmplqc46JaxKNQPgZ5k5EX G/23vekqpdTc22RLBtafVW47vW+Jequ/eSCV9ObE/b2j5HXdd93G2wESc2roklzvr5qnEL6cX4b S6SQZ5j3yrxo21XrBloI7KTj+XaiRG27QrJ5CqxN/dnQ77vGOJPY/vhmZHpf0YjELoI2vylKP+l KKinczj+fDN9OL162qEJnOn58KSFvQviNx0Is1TPt2LoYk30l2I/5Ga72W+SflJCAWYMPBEBwkT rwjTv2CqWkebZjiE16onqrwHk9gkdH9/Wyon/lJMXW9lb/Xm29+jK3AcBi+OPK3OljwHqayB2X0 j8CvAwe+7cD/yXg== 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-20240816_035459_189078_B421BC4F X-CRM114-Status: GOOD ( 12.49 ) 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. Reviewed-by: Jonathan Cameron Signed-off-by: Krzysztof Kozlowski Acked-by: Thierry Reding --- 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 Fri Aug 16 10:54:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765963 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 319DCC531DC for ; Fri, 16 Aug 2024 11:01: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=Ofyujhdwo9HhuT+uKq2h0ijjUNuG8zhSZ3XGJMLvxUE=; b=skif4M6FCzIVC5UkCfcgqc5XHb LuJY1tmtJ+q1pO6BNVJCtWjGoZX4soA6lI4BnO+h5F33y2Yxj8sQdKgfVsg7bcWpRfIUmkcKRsQQb HFLAMFia2+bL6G6wymVPssx/9bG+79jmZS1wcOlQf2hIh3+uBqoGgHzBUdMHJ7dXwjH1QdFwuw+P4 ksZN3WT6B8kexZ2GriB2ITrlj77v9M6cakdzIpZDZOWi2CScgA1MhkjrX536UFdWhcSYcBfzFRVFm IzM1ZrlKC66pses8LIl0bOZ/7cFovkg4W+RiCKiuulp6Qdm5Q+NT5xjQYprWdyRRs4JtS6oEBX4YA XhDHKRJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seui0-0000000Cg3s-0xsO; Fri, 16 Aug 2024 11:01:28 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubk-0000000Ce42-2bCY for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:55:01 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42817f1eb1fso13336175e9.1 for ; Fri, 16 Aug 2024 03:55:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805699; x=1724410499; 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=Ofyujhdwo9HhuT+uKq2h0ijjUNuG8zhSZ3XGJMLvxUE=; b=PboL9Ya7uyFM+MicZR6UduWyyZ04icJfJc4TrB5OdH86SWCjYKjtclHWCaUlv3tost 0y4tUhOrioo3uLg54Z3gqOejUQIdn8PcHyIAaeiOAFYSry3YtNX4gGNEaRvm8CCobXOJ cpQthIITNKyPj/D2nZRn3NIxpxV6CsFWuWNg+79f4ylefqp825KZDEN7/J4bYVsFI6uU dAc37zzJLEAdiIhsT65uNnZg0Zv+rbnRuTAmsseWCkWPpCg+47h4pDKs01gTVktHvHVQ XfUFfNbHIhbai9kpeNlrIuw5gMantD3utLzZVDXkp+cMwUD+LFB4gVjiVwOd0tEohq/r fsSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805699; x=1724410499; 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=Ofyujhdwo9HhuT+uKq2h0ijjUNuG8zhSZ3XGJMLvxUE=; b=EQ6B0tbU+gr++q3gZQd9pBSWoQYMDlsznuER5A3iEsfvcSlH5lURNDCjN1jPFPihW9 t4QsTuMFlg8uwIZCBCd9FWgik21Aiq+Se6fpUFswOUmBBE091rzVopXH5T0wrd6/WRng xrBUEzJvPLPz2n+gc8zVwGdqqzLei6EojirBW8FBdbl3vsuKoSI9ZFELr98Gz0HEopmH HcXXjixw6LJkEiXg6g+CEtvvU3nNnBmyvmkU0U9YBnbDgyiVPCg8tnZweClqcs2kW6fE hrmDvt4vDc6mbfdR0pkpoAShKow+SiZk2bgb9byR783NXMx9PQzK2aLODT7JUOT9f9vs zGSQ== X-Forwarded-Encrypted: i=1; AJvYcCV4RdNvSzoVpOkqTfD9I4BhEgTAB4pQiiUWrVICt1qxkIxi68fYyDr+zr6WC5xT8VAtmmDJ+8CcKFCoxacmUfDmH87W5DX90xK1oJwQJTxEMshkeUI= X-Gm-Message-State: AOJu0YwlblOj/iMGtDcqEjR46cKfyxwNkHivDJEhSIgikuI4O5lRAa8C l1BIZzcj2MKNrsVUSnEioEFPeWdQtvZLlPWFhIxkPe01vOTV5dKYS+vMQ072wls= X-Google-Smtp-Source: AGHT+IF1Ki7kkJVeoFcsxkp8A7OnvN2/y+Y07xGgbyNW/uCef1ZfE+zmmjjSZ7/A05BtryN3zai2Tw== X-Received: by 2002:a05:600c:4f4f:b0:426:64a2:5375 with SMTP id 5b1f17b1804b1-429ed77da5fmr16657705e9.1.1723805699218; Fri, 16 Aug 2024 03:54:59 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:54:58 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:33 +0200 Subject: [PATCH v2 09/13] memory: tegra20-emc: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-9-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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, Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1278; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=H9pgFKFZj0vfgCksat3pZIHsHYX7b2XRIDWJ9Ds+vFo=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/ue0ZjWg9eHgEHo9vzwpfBVB0sZcVnAPvqh ztGhVs5Qm+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v7gAKCRDBN2bmhouD 10PCD/9BhzHHyMZ1ybl9Uqzx4g21Dxc1765kJu8rXa42a0jWJfLt6GovUNJY2+gsqS7uFhqlwYm sYqfjAEwQuwL81Qj0fovqGeHxM9A5m/XxYSRm5LDhA0CURo+9gC4XukSN1NGwW+WGaJ/ocVQumY cL8XFrAXoTmNk16mAmgIkfQz8rSugfhTJcLO289UGnghyKjjzWiYKseuVRfo5tglKkluXJiy8a0 9ctneDbYsGEm1FtFUlKGX4he7OZ+5MHRK4NJmHVib1BK1rJke4axNolcwehhHsygI/DrNhBCCqx PRJkXyoUexFGGT9tGBQ+/BvjB0JsHagEm0S8p3PXvn5XvQwVmYU0xRNHayJgS7hUnLIGkzhgKxa lMNwPR+tO2Scr4P1Zat9I1s+5DBqnOcqA3TN6XzF4Pc+UlEEJKcygMrmseG1FFzBbLETGURcMyY CiA+MI2bKJF5a7RQWESVKSIqSgnUF7cZbuKY8P9aabxn4/Xl3vF3BucyIwjZhGprxPDCNp4M9zA bwVblrv0vWmbHK9RqtmIO67gBgGhoevTs+XfcQWZ5dJE5IjE2UdcDaDCGQsrUIfebaUcuR8sIHZ kG5UZSt30jVw8ULHXWOtX1HO5TOYjXYWQbPMRzgCrpqKy8yMjLLSrspykBPUcqomNMYKiFC9x78 9IbhnSsdWiJ96Lw== 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-20240816_035500_692692_6C7A6C23 X-CRM114-Status: GOOD ( 12.54 ) 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. Reviewed-by: Jonathan Cameron Signed-off-by: Krzysztof Kozlowski Acked-by: Thierry Reding --- 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 Fri Aug 16 10:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765964 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 AC1AFC3DA4A for ; Fri, 16 Aug 2024 11:02:22 +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=QdFTvPO59/yTfOKOt4WGN5S5pj AWV8WfctFN643PotAPOuCX3Zds/95B0cQyE09SuZ0WDA090bfy2RxlRztCN5yFfHmfMP3nz1tMHuz o+wYyM6JxQVyGTaoMfm2CPgxtYbwMF0wk9Cuez0PI3xZIglKwCD7qPLRWM7EoAhhTqeg652+gLJgJ a4e/Wf0KE+ko4M8rk2WOIorXRDJNq0+YpTaxNLkINVDskLEyPfYKx5B0ZS7junEm/Sqpnvlj9whTU 84yO9HbP4Auxj0GggXR6RfsaPe4hAHKgUXbUd2P5ryB2S3rQOAp1r/b45+5r6bJNHWHSC7m4kx99f mjUXwhvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seuic-0000000CgER-49Jb; Fri, 16 Aug 2024 11:02:06 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubm-0000000Ce4a-3kIt for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:55:04 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4281ca54fd3so13224265e9.2 for ; Fri, 16 Aug 2024 03:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805701; x=1724410501; 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=ySbKOBfumNAX8hYlamPW/HcnJz8WhLSKhCDWMawH3p8SqYE+R/3ODiP8xTBVPkBFFe esUlPLjn+7rU0tuG3i0YSmojzXa0wwAI+7TgYgjwms6kkbKIqrqVivQSjGlr/dpKS06B kEZF7GguJVPJV2ertZeA+kRfrrUYZvfI9osSFblE/3/1a5iL5iRcm4DJgW5LHOE35XFy AvoUc9a0csUFz4ErOBAa0JRVA2OBYAo80V5EqUKakTp1LOEqF1JwblPnAONgcPsQBgA4 yyOtpX3UAA6/oJ5a8Z+oRS3RqZiwWqJad85udS8rAgMUC/2i4r+WcKGXb4uQanuQI7xn nOPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805701; x=1724410501; 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=ROGS1ARwPCpFJJWjyGP1jpkVKhu+6UAP0/MuYJgiO3AbzaMVyl9c42dhGNqw+2oH3F JphVmxTAcQyfGxtOWJ2viKw/5cKoJ71a96/elU/klO1hanMXVdY0nAHA30J878bGZnQG Yj4hJMh6Wqa8QzclsfwC6MkF24oMqeDNJXhlUYy5XJbZXsLioGMyE+i2njNcMJEUWmjx zpUF3pqVm8gpbcNIhYk2Qm6Q7VCfLU7QjuFRVb5lpnsboln53gdQ/G7WN3fKwc1ZBA/c 3nfHGmMQmIfArqsnQqhN0WVG2YxlblN96lrSuor/Zzc1Ox0u43xJylIyIJq719VudFhb t0mg== X-Forwarded-Encrypted: i=1; AJvYcCW1W3ATD/yDk3eJsbecd3ODOJKw/rveEl2p5PLB2k3McsVsiiMo2zrhBvEwftFD7YPE9s79s9ioK1jSGtgcr5mSrIfqNr7WbhCEa7DlZx1b55Xu8EE= X-Gm-Message-State: AOJu0Yxgidq7OqqxPQJKiIQ18O3w/x/RxTVqg7xPVCsQShkU6812VS9h 8XeRTw7wHb/15ZuqNo3kjNyiZVN4DdpO5X2mfKoMwqQjv5AYEmfLyS/O4eIi2QI= X-Google-Smtp-Source: AGHT+IFUFl3LQZH8vi3ztVQty6MRmIGJqwYCsBA71b8YZWr3zj41X4UgzipPWDyIskK7OaUErYWEjA== X-Received: by 2002:a05:600c:5101:b0:427:abf6:f0e6 with SMTP id 5b1f17b1804b1-429ed794e83mr19346385e9.9.1723805700849; Fri, 16 Aug 2024 03:55:00 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:55:00 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:34 +0200 Subject: [PATCH v2 10/13] memory: tegra30-emc: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-10-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/vcqoU62xWOzA1Uh1XhtoPiUJ6/p082Y6tV /NdOgZszgKJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v7wAKCRDBN2bmhouD 1wTED/91/aMKQySe34DvngSXlprbbqVy6N5seV1kcoB1yChmNG0FsMDP8UW9rQzbmi9E2LC9gvo 93BdO6pP3JQTRaEvxG3bDLyFWuENgrfLBLw74JQI0x0ph+OHns7cxJfxiG/0gLhSPsfA5s8Y5U7 cjBNMhBLld9JvKkhu4vketv8eiWTxu4aQ2u8dVwfqXQadDhAqfEGFzctPWipkWQoHlkZdXOTYGw ty/HFh/Q6mTWG2EFRNxEQ8OAVgK2d7s6CkTRdi82rdRn8aAlhQHqH2M0V68PS0Yr0QhbpV5g9nd eb/Xn+8Dtz80s8P8RoHX7nqhZuGEXjoLwTmWoO0LfUGpUEXB3Mzxap0OdBYMHLkMyDtF60rv7V8 Hkc3LU9yZ+InrVgGK3WWYcrJI1lQhZH7obEFJjuPaCxQ9NefcMJiryO/30ctIdU5go0XSAgqgCt tTyKtsLD997xfQT2GMAxAzCjQ+CJ50MQS+h2pJjs3QT+LKbr7aMKEyLCQpVEyNtOgqYlqkd/AyC Z5jHXbA1Q0ThDYTURtwDz08/yMB/VYpCtqbYuHGhWVetzB8ndOMbJqVl0AulziVSLPjwZOE/M35 WV/hGezQJCAHALZ7CxOXO3EXB3aXTC6PJQGTSl3qAJfUwvYBpMOCbU54aWOnGSJoe/t5Mt5Cxw0 joPKpZTK0fVMryA== 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-20240816_035503_000957_6CCFA327 X-CRM114-Status: GOOD ( 12.01 ) 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 Acked-by: Thierry Reding --- 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 Fri Aug 16 10:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765965 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 03121C531DC for ; Fri, 16 Aug 2024 11:02:59 +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=c/iamU9GEr5KdpKg86o77KhrKhRKzAxdW+GEgZ6rSGI=; b=nXfrSijY8C0vejiVUGDCDYONXD URT/BSuEL41B9LQalE/CgHseOw+r1kTlpwACLUoMQe6/curx+4QPVcVB9CP9Ofq6kC5DlmSCT5BFT BJcLI+0q+yqtTn4iG3FIanFMqwDBlnZAZy6TNhC4XSXC2y6h1e7YokClLdxjdEz6D9KviiwTEzuRV ZC4Aobwl3ECjtA40Ll8AKxZrvxXVt5fW+40fRI0/iQE1zXUSdWAOV/pK3RTrAfrJj5tXyzphUGN0E L+GBUJNrffIF++EGBXKo3O+CkLhMJRkV5NIxYUFyd3PfkG6n5K+YVUzBheCQbkjT3CVBxPrUmMqMD CIk/VUqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seujG-0000000CgMb-14OD; Fri, 16 Aug 2024 11:02:46 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubn-0000000Ce5G-3a92 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:55:05 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-429c4a4c6a8so13533785e9.0 for ; Fri, 16 Aug 2024 03:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805702; x=1724410502; 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=c/iamU9GEr5KdpKg86o77KhrKhRKzAxdW+GEgZ6rSGI=; b=er8P+6Qxx2E4SFtblx97wG1wwvnS7L6MqMp3xNhz4dC8nONL4hJtOZor2iKiX7jHRF njeTPS3BRhk3q3jVTsan2JAtcCZya6hFTGAu4l2v1fOXJfjIavGCn/eoCdFl/F4eix64 KIojVUsJAZqZuT17HjX7dymblAHW3yCYWS56LhEQ5HLPic1OAWCbxoXOcEwerDqI0YVq MNW4tBPWPlOa0UrfEe09/MTR2etdFmf+hP1rAPVQOrAdIQOz8XOTNOZwpjHhCQ//w05m E7MOXu83gTgFC4kIYI7JDQakmVRtvPAhGj6u3AZK0MBhiVYZ3gVosSDvjtF6UGN08PZq CAIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805702; x=1724410502; 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=c/iamU9GEr5KdpKg86o77KhrKhRKzAxdW+GEgZ6rSGI=; b=Qp9lJeK9eq0pLlILito1Ifw2JbJ+9NFRnYZPpNomLQtspyOhpy3fmhwUFD2oKgk7rc jJ45/Xvw9OdMuVuUSTPFWrmCC53lpSRQtWYjTGPkSMD61Szn32TwblNG77we3Fd+scR9 6PfvbV7AK9es6VfXmqd84t5YWSiaLbr5fily9uXEgYWQwo/suHgTBJuMC0xmRMZtE4Nv N0SOmnuy91CeYW9kzrRQcoF/Y9yvMVWAzUbC2l+o6kV+JZN/VHt5d1OEW9+mw7NQMWbI SOVqqjqiw2IBGdwYGDPYB0Be71AYmRfPWMS31nrl1KNCl9z0c2vR1EVhAEhSpE+RBkP7 goHg== X-Forwarded-Encrypted: i=1; AJvYcCXStTHmgf3ZPYGl0VK/fuwa8OQZ/WdH/cBzA9aqzcT/llKz4Db22asBPaWrEZcHEDjFao9LRXCDTIK4UD87gU6yU1yELXpPquPkmhIgbA3CA0h6TbQ= X-Gm-Message-State: AOJu0YwB7wOB7DooKq9vs3ygbbR14hMLuxSEMdL4/9FONyISMFqTy5Tp Kv8L5MVIxEIhxzL6bFbP324Dr2CluMNExdhMeLFY1dsgp/CSVoumDd9Yb3ME+ec= X-Google-Smtp-Source: AGHT+IFqPUcKioelayo+oH3fVDDKVUXmOzw5MuZiD+mM3WrmH/wV11bVb9kfp9ex06bAss09/vs1xA== X-Received: by 2002:a05:600c:4688:b0:426:6ed5:fd5 with SMTP id 5b1f17b1804b1-429ed7a5f5dmr16488295e9.6.1723805702352; Fri, 16 Aug 2024 03:55:02 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:55:01 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:35 +0200 Subject: [PATCH v2 11/13] memory: ti-aemif: simplify with dev_err_probe() MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-11-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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=927; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=VDRAiPcP3Nj5IaFsGnt2Bd0rnGw6XleemS6wXHO20gA=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/wrCSs8PTy9a+acv6ve1DhHDKLl614GOqhd SLF3vaqGJuJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v8AAKCRDBN2bmhouD 19QTD/4ph7Rh9kOERlKeQFJlMtStsZ/eIUNcyB0K1URSMda/NtsfAfnuC/k29h6RvyDDcqr8xlU 4XTcEwCMwQ1nBxT7XwQosn1m7gZ0xyPyfstMv2PIQ4dlIutMxCGBsUUA9XUiKnVr5Z3C+ifWmVs hiCR6YfmrmHZfjvpidFRdVOhblMIxh7DEwIV8WTCeMQBlm79y3Ah4KYJtwZrjMnnC5Y3roYoOEp FKnlAjPZuA76rEN8IrNHYMKtm+G1yAKENn2PtnYN7Fl/JtRFPjhS5jz1QZ+svOcTVrUTb1oBBwh 8O8Rwtppmn+QM6HXf6B766Qs94/nbBi0B61hffqHUDWqAYbcQcw3uHydhMv2vIFyskftpsIjlCv iz5SDKPf5wpdk0t8K7FRVMAGAMtDCgeCi4ncPmwW+lnJp3AmiZp21UWGHROnv3cRo7bU3de+WGy lV8Kqsp2Yrl9qRYA0I21p4fKoMY8E47YKHjbZ6d4EL/7ADBxSrAWDosifQkJXVrSNWp5xhoMA7O uzrobE9b0fbPc1tPdhHj9rq9uog9sq6xmJOthMwvkmCNwWUrDCya6BUOkeQ8OAfA6Ax53z/WQG9 ADoxcmY3NwxxKo3ClqYQRpvaRA8CgXN4mBgz95fJty1IUKESCJ+a1idDrbVjqLVO3i8cgccxA2T bGuzLnFPy3XU9CQ== 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-20240816_035503_936437_CF8AE07A X-CRM114-Status: GOOD ( 12.17 ) 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 dev_err_probe() to avoid dmesg flood on actual defer. This makes the code also simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- Changes in v2: 1. New patch --- drivers/memory/ti-aemif.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index e192db9e0e4b..360f2705b1ff 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -345,10 +345,8 @@ static int aemif_probe(struct platform_device *pdev) platform_set_drvdata(pdev, aemif); aemif->clk = devm_clk_get(dev, NULL); - if (IS_ERR(aemif->clk)) { - dev_err(dev, "cannot get clock 'aemif'\n"); - return PTR_ERR(aemif->clk); - } + if (IS_ERR(aemif->clk)) + return dev_err_probe(dev, PTR_ERR(aemif->clk), "cannot get clock 'aemif'\n"); ret = clk_prepare_enable(aemif->clk); if (ret) From patchwork Fri Aug 16 10:54:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765966 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 2FB37C3DA4A for ; Fri, 16 Aug 2024 11:03:38 +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=sr/Bjb9gFmI1Ph7TbTdrGjwvQKhvfIr9sm0jS+XptdU=; b=BjW1HMaXeB9GpygGIkrGAgOSII DmOGIivlWl+4pdXQSrPnT4Tbgb7QCDp7zENx9JLR+0gGlKm7bHS6nJnMnfqoYtw/I0njVDUd7x5zC stiKnrLI1wjJm5a9kiyDdDeWllXm9zgF9wH9Gz7aDiCbsIMuIY16XOAXnL57wC/b4/L7TcgwXNWXb PhwMu/UXu8h7HBMDoRsY1U1xGJcBYLqQn7ItyW/3seAolIkCImh8jz/U+E7/4GBIbgrkwbwI4PbL/ 1rp046teq6/LXdJQA+COKdv4vezR8HjC0BLZqaxomOM/6gk9mYgguRDvzp9tPOATjoQlFEpuWNdHC aqqsX3ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seujt-0000000CgUY-0Okt; Fri, 16 Aug 2024 11:03:25 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubp-0000000Ce5r-2QkV for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:55:06 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-429da8b5feaso18484045e9.2 for ; Fri, 16 Aug 2024 03:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805704; x=1724410504; 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=sr/Bjb9gFmI1Ph7TbTdrGjwvQKhvfIr9sm0jS+XptdU=; b=MCVpxE/feWMGaBKn0VzNyL3+0rgbnXJrMT+xGR8MvoAvD75DrRuIa2aNeDlDJBOZwd F/zKAJkhP7zDsqPmqGgjy6fF5jFjwQ7maHxxnKquLcagLqyAFuf41wfsYWWuWc2w5qGF hUGElOOAavcp8LD8q0STKPs31XGw2hS+BaL3px1Z//Er7/107kjekQXzD2iVzABuDsme juBzi47TyLJtOWHI8uolnOhgJjNfqaqaqda6s9ZfeYhVJT2GI+oZKSHprtZRIincn3y4 Ad0eFX+dOBT/wbk4ZPZkZEB5LUbbNWm9Kz/JGZOhyybkYws7K5D6xbPXPwbft6DU4TnE qq2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805704; x=1724410504; 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=sr/Bjb9gFmI1Ph7TbTdrGjwvQKhvfIr9sm0jS+XptdU=; b=EEffpcQbhtNn8nNAaa52MO0Cgt/k+U5zxdd5fAfNNpIwjrQ5Civ7u5/m1S5LTaNvUt 7T1MeRpU6sVKcIfJhtUura82N48PgsOzL/1BLSCynZAQstWmhoxvhobgJBlq1wFR2yNZ XiZDTDnkBikkQvJFVtvZr2W5af/lXxN1mFVHbUWfkShUcArgWfK+y/WeEUBOie8SJZJG QCd96UiISH7vYNImwzyqXpBdPc9Lx47AFogX9ftyxe4IConnp/sPVduApxhxrgS8GK/h 42RORoATqk+mFh2orEf3/jHZkHqONfrSf60pg1p5qdQhVpTtuoeVy4W7s2vpazQqXu5Z 7Jqg== X-Forwarded-Encrypted: i=1; AJvYcCV/xDykXJN8wMeWJ+XE0onTlrfKFvYxsqSh+sbhdyha1zpNBAgCtnMNY3Nb1YbiL0SMipHfr5++y66C54NPK3aq481SKbivcpxvpUiiycs1OSTOA9I= X-Gm-Message-State: AOJu0YwCM3eSIa/Ayzact/HUiHd8DnYflekpdgPjPyW+f3kHOAxnc3hY kxAD8PXXl9UczmwWKRQ6jRCbJ7W5nxXPtY+MEQBJbV2/Ytb1EeWvL6CiaMkQTio= X-Google-Smtp-Source: AGHT+IHb5s6ZOWiwXyP6F+jIPWHsZbVQ1dRLhQ/L4QjqU83lUzy6ofpXe6PirIt9dJ+aARfVbvTAsA== X-Received: by 2002:a05:6000:ec4:b0:371:844f:e07 with SMTP id ffacd0b85a97d-37194315732mr1838165f8f.10.1723805703804; Fri, 16 Aug 2024 03:55:03 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:55:03 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:36 +0200 Subject: [PATCH v2 12/13] memory: ti-aemif: simplify with devm_clk_get_enabled() MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-12-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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, Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2695; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=sLKW5NlUarRy9P9QN6fIhLPqmjJ63FYokcmqbGYfWRo=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/xx0XSFMIPdFQTm4JsvW1nfOTyJJMoinp2O kk2gGkLpXKJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v8QAKCRDBN2bmhouD 13OSD/4riPyN506VHZZ2EtdCDx+J9tg/8JMuyGK6I2fpgTQ/UApIm8QW28ZbKP6Gi4RGaYPLju2 gsf2u14b70xcxQIsZQ0/4SaYjDmdyBfWtO7eiEPax9Ib3ezPylJMPsH0oSRv//ITyMXKC99xC/f LgjNORmCyfpeum/TIb+/wgJZfIsRcuscyK0xJVvf9KnipkclzhvsK+gZGCpj2HaXsBa3mRgBegY weZX5najE0BjcG+6o9LNJyCW8zuXfJ5jwNUSbG6zCGHFHV4nF+Hn6yGr9mhswoD/FQ6sl5WO2gi 9wGfXT0evEkmVKRgBfEGpOS58HPNPidZ1vm7kOImjVP1URT47cFw0KKF0lm8B8Ah3YXo8k8Wsmy jvSOvU9NI5IL0iIcFM+tFqcpIz9oyg0M8bxPFDjgkXONJMDo/iDvq/LIyIzWELnYMKEbpKbnMpw PH84I+h5hz++T0WuBEKiwAYRBuXVsnJkMtJA7XHBjjaISe5K9a6xBYNDGkpleHhkaozEUcn7pQ5 NyBlJOjDbmx4CPXuGGm6GKBwBCjPj1kslTvLNQUeDPaU84L+J9Q8nFNbrDS2bKjwrJ0YFx6n8MV 71F+bp26PTcPmIYfGGMF+V0i4HBYaBDhYviK1uQE4rEP5Pu6mMVip5QJMvadXyXyCOyGSopSgoB muVoxO1VS66+nzg== 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-20240816_035505_660164_7DDFFB7A X-CRM114-Status: GOOD ( 15.65 ) 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 devm_clk_get_enabled() to drop clock prepare/unprepare parts and make code simpler. Suggested-by: Jonathan Cameron Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- Changes in v2: 1. New patch --- drivers/memory/ti-aemif.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index 360f2705b1ff..bb9c8132d8c0 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -344,14 +344,10 @@ static int aemif_probe(struct platform_device *pdev) platform_set_drvdata(pdev, aemif); - aemif->clk = devm_clk_get(dev, NULL); + aemif->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(aemif->clk)) return dev_err_probe(dev, PTR_ERR(aemif->clk), "cannot get clock 'aemif'\n"); - ret = clk_prepare_enable(aemif->clk); - if (ret) - return ret; - aemif->clk_rate = clk_get_rate(aemif->clk) / MSEC_PER_SEC; if (np && of_device_is_compatible(np, "ti,da850-aemif")) @@ -360,10 +356,8 @@ static int aemif_probe(struct platform_device *pdev) aemif->cs_offset = pdata->cs_offset; aemif->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(aemif->base)) { - ret = PTR_ERR(aemif->base); - goto error; - } + if (IS_ERR(aemif->base)) + return PTR_ERR(aemif->base); if (np) { /* @@ -376,7 +370,7 @@ static int aemif_probe(struct platform_device *pdev) ret = of_aemif_parse_abus_config(pdev, child_np); if (ret < 0) { of_node_put(child_np); - goto error; + return ret; } } } else if (pdata && pdata->num_abus_data > 0) { @@ -391,7 +385,7 @@ static int aemif_probe(struct platform_device *pdev) if (ret < 0) { dev_err(dev, "Error configuring chip select %d\n", aemif->cs_data[i].cs); - goto error; + return ret; } } @@ -405,7 +399,7 @@ static int aemif_probe(struct platform_device *pdev) dev_lookup, dev); if (ret < 0) { of_node_put(child_np); - goto error; + return ret; } } } else if (pdata) { @@ -420,21 +414,10 @@ static int aemif_probe(struct platform_device *pdev) } return 0; -error: - clk_disable_unprepare(aemif->clk); - return ret; -} - -static void aemif_remove(struct platform_device *pdev) -{ - struct aemif_device *aemif = platform_get_drvdata(pdev); - - clk_disable_unprepare(aemif->clk); } static struct platform_driver aemif_driver = { .probe = aemif_probe, - .remove_new = aemif_remove, .driver = { .name = "ti-aemif", .of_match_table = of_match_ptr(aemif_of_match), From patchwork Fri Aug 16 10:54:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765967 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 6D697C531DC for ; Fri, 16 Aug 2024 11:04:17 +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=xzZC0M9EYFXrRYfn9TDzsNDqOMCKTr68cWUMx7V2XT4=; b=CWeNPMD3VleqnIxoZ1ul4AhGVc cZmzjMImQKc1mksI43Mnrmw5+bqrmNSB+QilTwSy27Ge1rhdDLydwyIvbTJ6TR+nrQpMjc3O1ejf6 iK0cno9MyrP1LdmOXekhLxyBZY4fUrp5t3b7xWone50W35ahpueRoqSs9snaAqbPySeszKIoDH0Pa BRFj7CIaeCBcjhIu0uF5bKBFNveyPLQHSTh6LZN/VBEFtFBaqF3ek7aai5psUslVUXiDTn522gAKC 71dpf7OTXTMGrIp9tiN4jJxDgSjMJ6I0upIzGjjSlXtr3S1DEb7haRya7XBbmVriR7Zads8iDIDiL jOxcB14g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seukW-0000000CggF-0A2I; Fri, 16 Aug 2024 11:04:04 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seubq-0000000Ce6X-2h5r for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 10:55:08 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4281d812d3eso18465385e9.3 for ; Fri, 16 Aug 2024 03:55:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723805705; x=1724410505; 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=xzZC0M9EYFXrRYfn9TDzsNDqOMCKTr68cWUMx7V2XT4=; b=K5xNhWoE8+9Tyf7wI/VVfzuIgoufqV2/aTBQJ3uf9W4YPabi8nXDRyP8oXL+4gaXD2 MyZcCSCLb3uw6S1S3c19XhaO0iZY0ZptAV9HOKqU+S7ugc9isoBrAv1xlnLa3MYrGc9j wfYj4600kwRW/0kUis//rUhPn8o+YMTgkh0VgMs8vaFkP7Dzl4fW/MAiK8PdylYIwONI Q4yDLc1mCIIenhrpNR4eXncUDJsbsTNqCLBJdRoP/pYDn5H7ZOzK5NaY0otMG5s8q1W+ FUiAbkwAeKP9Bl6Tx9nZV1AFxeSmthwm/6fS4XrMhAb5CY2+vnIwkMElIyIHeVAx1h0D Zz6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723805705; x=1724410505; 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=xzZC0M9EYFXrRYfn9TDzsNDqOMCKTr68cWUMx7V2XT4=; b=IxXhJbcJBeopOwlZqyRsmcOKWCAwiCj8PAY6E0f1ff46B54vWMtgTWbT+dplKzx/Uh 0aJUNa4FZsuHj1ir8r80a3c5EJizwYiW4MjnbkxSYAyhFmPbzFDiujCTRte9Nin87mWy h55v7RRz4xsb3RJDdH/a1Rc10JPDd0t5y6tN/pbmI7qj0zOH+/miIFLWG0KpEDTiNt4c 635/1NC/70h2caCZtfo1mV6Z2W29gosf+ZxqLNNtBNiVyE6iyDwKZkODbIeQSSwIzg1b FwcwUl80Mv8h/UqdRDPPVAtYXMfT+MFwRtcompGanMbquAg2ps0hPjKiRUMusFJooAbv PzLA== X-Forwarded-Encrypted: i=1; AJvYcCV4tdTWuysvYklD5GpkMk2LV1K+jgh60nkknOLn6lAYuuYn8ZFxOqsmz2F+RjG1epv4TZJSKatC3Bu33wkKUlvQ1TnlJjv/XVbM+xZZxSKkTru6atg= X-Gm-Message-State: AOJu0YwGlobZOawmzADlbJK3f1mYC+RjgB7YbhKOuBwXW2pOaXdaFchi w8L3mDVCE37BDAXrCC8UnbuveParurbaoLoABD3HJEdSyob0OO1LRFgkR2DX22Q= X-Google-Smtp-Source: AGHT+IHjZHJdqi78iF456VbGb6wR7RxT96NknEiGEFoYeO6BRf1QVX7lFBSfHR9ooukIBdApMHs1NQ== X-Received: by 2002:a05:600c:208:b0:426:59fe:ac27 with SMTP id 5b1f17b1804b1-429ed7d6481mr18549855e9.26.1723805705202; Fri, 16 Aug 2024 03:55:05 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed7945cesm19461935e9.40.2024.08.16.03.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 03:55:04 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 12:54:37 +0200 Subject: [PATCH v2 13/13] memory: ti-aemif: simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-memory-v2-13-9eed0ee16b78@linaro.org> References: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-memory-v2-0-9eed0ee16b78@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=XVq1bAp1DPzbReC84gkm7B7jCsUc7V7wiEW2r5jKKFs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvy/yjJOSs+fjUCguca37Fmp1Np6bS/o8AycYV q1DSeQLoR6JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8v8gAKCRDBN2bmhouD 1z3+D/4vIO8HONcnYaJfvUTePd6DMbBbn9F/+h5JlkVZ9zuC6/FNYFAdsOVvol0buCd7GaQWZvB xkVBikxYPZ/SpZ/juDJ1odkOaVuG+6NFpphe6DNYNdwhio6ejIUqUcPYrgF88Lkc315GuP4WaHh LQrpEtjlApG1WaiWbwIyWH2Pe6aYg6XG2Qt5641TUI4xcOu9mdemiA6giWEpFo8OS1fA3vgDolp YQWUT5h/oXmzvUoFRt6nTrOWpdPc0cUcectO/1sJxCzVAn6+idbkM/UCEF6dxovgd0Xq1rbtS8Y HSlVMFGLgkJ1ujF1QHVdPYR8Ms0Qgsk3cJUMNbvRKw4BWCyPBa9GM+1gp8V+5O4ozHdWYpNwdNJ WTVSTv3lSokPa/71tY2WlqDaLwd5Wz/5Cd3NxPrCYKSIti5jI5aF2DkO5fF1NES8LHwVKhwiBPh 1GDrE73cb3PgoZQaGrPa8bA6QZNnFoZ0Isw68JLrfs8DvnyGnS0kJmGZsxZvO10+6iu7fv3BMeP /yJ5siDXH5HJP4f8bqPef8kK6KkDxp25JKag4raVN91XG1UeuBdgU+0dIOlTfpGHsfvIgcvemJ6 N8nBHo+dkh0vyPbMITPZEbJASGRHeSS++0db3mzSmkBWtUYQx4Abnd2BV8WH1C0z24W+pTT3FS9 U08Yg6h2nsqgtDA== 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-20240816_035506_725215_84B563E2 X-CRM114-Status: GOOD ( 16.06 ) 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/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 bb9c8132d8c0..7b48303f183b 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; @@ -366,12 +365,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) return ret; - } } } else if (pdata && pdata->num_abus_data > 0) { for (i = 0; i < pdata->num_abus_data; i++, aemif->num_cs++) { @@ -394,13 +391,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) return ret; - } } } else if (pdata) { for (i = 0; i < pdata->num_sub_devices; i++) {