From patchwork Mon Aug 12 13:33:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 818748 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0B0F17F391 for ; Mon, 12 Aug 2024 13:34:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469664; cv=none; b=ZfaY2z8pQLr/EOzTgTnLYl0eBMklBL8Pru/zOBNoeLnVAHg1+2MaMLRNIgO8A7o0OaPRfWMKwb9Nbhaj7bQbQZD2eTpF8p5NQpXiLiCTBzTn+BJNyvEsaUUkeQtifwKgkugoG9BfwW3bFyt1lYBFfcLQ8uT0R5imvkiZR4jS5VY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469664; c=relaxed/simple; bh=xgfyKZmDDIbZTBcHgkC4HQRuoKCVphYVJo2Oqeoz2yg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EJcrC24liIoso1lPSPL2480nea+2fdZKh8+kMG1/5Fg007cyYfpIHWjRZkRHbUA9sS/CfLr/RlMD5vd7hevSmSMEDvjxi0/MiMuffwJdRYKNAGE+KNfGruuXaVxOmHvVuN5U3JTBovFIMoFRwuHon7FXRAK7B8SlAF/rYuoKq3w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=T42yi9ZR; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="T42yi9ZR" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2f149845fbaso45830461fa.3 for ; Mon, 12 Aug 2024 06:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469661; x=1724074461; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=T42yi9ZRQi7mcGBQuq95A4B9nSNoH6e+zy8IVONQZIDamNg1WFLsDZVrym/ZyuqxdN GXvByXue2HhXSiOvnL3pmqLNr6Ob85zhSLvhJyOPyIOZqkI5uvo9rtcPPpLxXWyqDlW7 i7IK5xiEgie2TIt0fcHdYObLU8g6uONoO+ahPnGuRre8OvPhG+FY7ixt4JPZBdRbNSEf gT4ZbgPNm25HXGebuZp0lBMBvFEaBnscMmrPft2nuuO7fdfQZNQASuAeLp/wgaog+Fac V3hAbqdZNal56taQ3bMuZGYt7T7PdM8Gi9rYbOCDCex7iP0buZFe+iEyarsHCzpFPFFo oNtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469661; x=1724074461; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=Hj0JKy6PbxcbdrWqfRx2UytEuu2fqThk/Tsd+al4tmSSCqFh6Gh5q1i2rhYY/ppUk9 gxKashafdvKzCBote77Bh25oe3HX/y5kksBKYps80W8uXl7OXCY20xZMZDGA/7S4WxIR FPBOC6/HOJLqYvZUheDPr6TvVhEBiTDF4+WzBB7ev7oMNB1oA1d9RV0ICl4pOeHBvrml 5Wh/Kpdou+zsUUnczH/brDFXJDGHvNJu/G9Wg1Yd2sAw7QPc6/pG/twgq2MSwG0xONp1 YASe0dAOSJMTC1zYQEkBDK3TMDmE6NhfAk2HUolgdsOVnV+hW5Vpgxx5j5j+EbvH9zQl DXhw== X-Forwarded-Encrypted: i=1; AJvYcCVLIRnoq3r7W9qWXNVidrxRcYazei2IY3mTNA8doffw7oru5lxXarGH7fRbZHeECX4qVnqJA55QJTj8YBbS+c5JxY4lRjYnftA= X-Gm-Message-State: AOJu0YyYpKzDoECCaxaK89ffxwcpuaYTR9FzoOUvJCOmwHXyyuiOXGd5 P7KaELFyyI8PnFgEjlrYg28OCKCtJEzGOXuovslIVo/I0BupZjI9xdpusfdEFPE= X-Google-Smtp-Source: AGHT+IHQihxBmTwZO+gpopSrog1h4Zwo6nfMe5CMTYHEB+GBFOYD57QnlF7TYHYQZ5mGOjHQLKtWjw== X-Received: by 2002:a2e:9985:0:b0:2f2:9c23:3412 with SMTP id 38308e7fff4ca-2f2b7156ee5mr2174791fa.23.1723469660887; Mon, 12 Aug 2024 06:34:20 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:20 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:55 +0200 Subject: [PATCH 1/9] memory: atmel-ebi: use scoped device node handling to simplify error paths Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-1-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2456; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=xgfyKZmDDIbZTBcHgkC4HQRuoKCVphYVJo2Oqeoz2yg=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9RWiZUzjyUB45cY5GRGscQmhk2n/JWQ8eCU OV6qDjUvVSJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPUQAKCRDBN2bmhouD 1xyXD/4zIloc9i56JR/7avOvWMonHwPMgxrw6eW1Ql3uMGbouCHddr07MRZROHf7FHGtaDBNSzW mxhzYldkGPh7W1K5fj9UFeZ2zvkfrn+rQdUhG83d4r5ihSPYCQzBxKNTUvwKDDrn2jZ/DWAjmfh TxjAUuNnwbSkd43KLCkjRjmKHg1bCsuc/NromW6Jla20roeAfx6ousA8KIh8deLOJvUSd9IjoTP vhWCOrq414zR2AtAX4vd2IsPJM2zqwKIUt/ZXVvpV6IA6I5emax215uBPI/tq0XEaLTbW5dH/v8 JpZBGwkHxrkWhFaXEUS01fvJMEE2G+rqeMxi9GJGQSITpOae42sKZXL7jCxwsDsQ5zgfRwWGvJ5 veNYQdH4lAPRjl8MUL3h1K42k3GfVx4S1i+6PqIyC7vk7MOfuUV2WBitHAcxMyjcQMbj8XsjyvB iMMGFF8VDH2oE6eJ4aaUv+Co83vS2sYyoIH7BWNGxvSW2ajjcesSADyFhNMcoelmhpGZTckxESl 82l1O1qvrtFb0986Is0vJ6OhgHDX/Eja/dCxlk9T+SvRzZha67Ecrv1oWVyttwKxwqIrlMjdM0L b7iludiktLPGaXEtTrzpL2Xl3GZiWkzR9es+685yu7ltUGzpJVSzqu8GN4yqwd4riFxIzLgCaj2 TMtGaSenJiohE3g== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/memory/atmel-ebi.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index e8bb5f37f5cb..fcbfc2655d8d 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -6,6 +6,7 @@ * Copyright (C) 2013 Jean-Jacques Hiblot */ +#include #include #include #include @@ -517,7 +518,7 @@ static int atmel_ebi_dev_disable(struct atmel_ebi *ebi, struct device_node *np) static int atmel_ebi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *child, *np = dev->of_node, *smc_np; + struct device_node *child, *np = dev->of_node; struct atmel_ebi *ebi; int ret, reg_cells; struct clk *clk; @@ -541,30 +542,24 @@ static int atmel_ebi_probe(struct platform_device *pdev) ebi->clk = clk; - smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0); + struct device_node *smc_np __free(device_node) = of_parse_phandle(dev->of_node, + "atmel,smc", 0); ebi->smc.regmap = syscon_node_to_regmap(smc_np); - if (IS_ERR(ebi->smc.regmap)) { - ret = PTR_ERR(ebi->smc.regmap); - goto put_node; - } + if (IS_ERR(ebi->smc.regmap)) + return PTR_ERR(ebi->smc.regmap); ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np); - if (IS_ERR(ebi->smc.layout)) { - ret = PTR_ERR(ebi->smc.layout); - goto put_node; - } + if (IS_ERR(ebi->smc.layout)) + return PTR_ERR(ebi->smc.layout); ebi->smc.clk = of_clk_get(smc_np, 0); if (IS_ERR(ebi->smc.clk)) { - if (PTR_ERR(ebi->smc.clk) != -ENOENT) { - ret = PTR_ERR(ebi->smc.clk); - goto put_node; - } + if (PTR_ERR(ebi->smc.clk) != -ENOENT) + return PTR_ERR(ebi->smc.clk); ebi->smc.clk = NULL; } - of_node_put(smc_np); ret = clk_prepare_enable(ebi->smc.clk); if (ret) return ret; @@ -615,10 +610,6 @@ static int atmel_ebi_probe(struct platform_device *pdev) } return of_platform_populate(np, NULL, NULL, dev); - -put_node: - of_node_put(smc_np); - return ret; } static __maybe_unused int atmel_ebi_resume(struct device *dev) From patchwork Mon Aug 12 13:33:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 819354 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3141F1802AB for ; Mon, 12 Aug 2024 13:34:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469666; cv=none; b=kivCNdfSNyCs1kx5Z/xTOsMqwQE1CDk/iYNoLkfHX7vkFIimOkmAtHNp1AICVkmkpo9maQTFqy5iW6k80A+qUQ7ryDnadCqZ3JTknAVq5ABG64WpgXbyY77NRfwZmD7GvPglm+bokoHge88qa9G4N/pfniUFpL2kALS+D1A35n8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469666; c=relaxed/simple; bh=gmw7sdXN++0ul8rDzvdEpJ8YQFeG56dlD4XcPKrvG+o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KcpuOa0RBNWWMg/2rQcyVxNiF5QZSfLS2v802Qy6dg0EzClpBbK+XVe0CQy8aKPFQZhPsSs8U6a+mhUum9TPwQJq8Gj8qxMsGo5XWf52FgUN2pct23IvRbQ/sPByI5ftgFwzd+SoOKP+N5COMhmd/qDXGIRW23XP88mB/M4/XpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=tA/IspX3; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tA/IspX3" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42816ca797fso32252595e9.2 for ; Mon, 12 Aug 2024 06:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469662; x=1724074462; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lgTXsPloyXfID4jwvyIhu24dRWJVHUfhWh9HifazGOU=; b=tA/IspX3w4/C7hCvLciY9JOjCNz/Z+KX9nal8rPo7Vx9zBl2t8RMQWOTDZw/aoHqot LuZYf30nD4HtYFtReos3XMet9o6c04kjeBGj6S4REmSd1+UP0Ht2fBSMy1tJ/rQGqcq1 RCaGdQNd4Ivk4+RGaghWWPeowShcAh6V6hoRZjC/oQSL2n0pVvfo0D7pWG14Y6P5mnXG AguHiwotV7iJpmDKGgAAhoLxibZWjZQDd4G0qugJAOExKCOEWBEZuixC7ymJr/NPXpMV UJl7LRVEubW+mBU19fu5DITTAG+cwrHIc7LTv66zHAp7OeFph/hZ4+/pL1PuDV9Xh+zi ZxgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469662; x=1724074462; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lgTXsPloyXfID4jwvyIhu24dRWJVHUfhWh9HifazGOU=; b=GBzqridWYesS/nRvavtPohSp1FqybzOFh5ykFWJtkEulS04ZWPiTOYto5UN5ArVbRA KjTalX3uq8oXM85ycziIEUBLCq5GwHySeX4Xi1BJA4M9dMT0fLd0K+NbeZGPwvDal59R f4kUUHH1U0m6/XIRabniGiB8voi4PH2NydLEW05dV0m29bpCw3i7w/sIv7L2AxnSIeZE zg4y/Pi2VvZiVkOwqtBBK6yRjYrTfYrr0i52wiP6NX9U1Lia6ZEqdQvsM7pO1r1LM9IH J+ct0p/5CIlMFNtj5AuXbxT4QwBexMas05mGXBnQljEv9yJnVRr8iQwOPSRbU46r+fg3 7XPw== X-Forwarded-Encrypted: i=1; AJvYcCU0+VMVwJEm/OPrMvOqVC/ozEgItlQYwgrAB3hFOBi5FdbcfynSylUAiSULwBmhrrcak+uC0TOfRA2x6GBabGgqpms9E7G0G5A= X-Gm-Message-State: AOJu0YyxPE86XSbzf/A2mzh2mYsRV+oVQ4OCaXU271MMkzNUx+Sw1/2P 36xx8K/0XjmplGN4KloASgDLRs6vJwXtloDZUP1ibwghymuLDEfB0b0GGNKOw7M= X-Google-Smtp-Source: AGHT+IG2U+2ivgdNzf99p2ylaUjGb2UicWlTptEg4n0FqVE6AqYOjcDIhqYbh/ow3uzGl5LVUnouOg== X-Received: by 2002:a05:600c:154d:b0:426:602d:a246 with SMTP id 5b1f17b1804b1-429d48976c4mr3808995e9.32.1723469662493; Mon, 12 Aug 2024 06:34:22 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:21 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:56 +0200 Subject: [PATCH 2/9] memory: atmel-ebi: simplify with scoped for each OF child loop Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-2-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1350; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=gmw7sdXN++0ul8rDzvdEpJ8YQFeG56dlD4XcPKrvG+o=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9SBLK2/VucpJF/zx5ZBYvmfrRBNn21ar0oB 3a/Cv0noJqJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPUgAKCRDBN2bmhouD 1+yYD/4qcA8Bj3tzEWx6jyRjX8fDvf+bTdrauIEu4tdm0NhBSOPEGsMhDXH6CgHSvmu29T1Kvz4 ZwZ+2AAdDjZmdWXiU9FiAnN0Q33OjNkDRlCR8sEXjyPyOmXnjgzL40SEALgNKIZi4bpTvB8XX2L X1RJgqy8kocB79a8itpXzdUz9K6D9nHmPXj31YzY8qhiq3bGZrMX0UayHyFFwZXzC4+MvpXbxpE 0IGsNG3fZTX84XsBX8bMvnV/Dz6Qh52B2e5+3gd9szOpKHYQjmw8sqJO+VzdNJ8WexnOV1SJE7I qd4gUgPlThSU/cCUNWlsl0UmvrA2ksWUVvqU0BKHOj/SEmh6VCnJ0sCtEB9v3sjVC0uH/KDQedm 1gwdxLTsFJugS6pDjZd3lpOH26QeWPz35qwz2kWyoFTFFhMDtygj7NtFrX/rXbXI2P/ykR8PKo5 TYETYdEEHdUE+q6d8/kWbMERlzyuEcyKeCTWOndMO1tmQOyoV2g2JgD4a1ubtmwr/LSLRU4YldQ mAqYO/LNC3hE9xUwtG4Zyb+KI3NZLLfTdEOYgTIIA6HLUEPlN3wrmq/7UsP+t1+DPndJVaruZn0 t50YYT/Qalyd0LGdIKkExmcImtEVJs7HbFZn784DibyT6IaArLfY99yM9caNxxgpedYMxOdsMT9 lDEND5PW7HyCZAw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/atmel-ebi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index fcbfc2655d8d..abc6c067b5f1 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -518,7 +518,7 @@ static int atmel_ebi_dev_disable(struct atmel_ebi *ebi, struct device_node *np) static int atmel_ebi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *child, *np = dev->of_node; + struct device_node *np = dev->of_node; struct atmel_ebi *ebi; int ret, reg_cells; struct clk *clk; @@ -592,7 +592,7 @@ static int atmel_ebi_probe(struct platform_device *pdev) reg_cells += val; - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { if (!of_property_present(child, "reg")) continue; @@ -602,10 +602,8 @@ static int atmel_ebi_probe(struct platform_device *pdev) child); ret = atmel_ebi_dev_disable(ebi, child); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } } From patchwork Mon Aug 12 13:33:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 818747 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84047183090 for ; Mon, 12 Aug 2024 13:34:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469668; cv=none; b=kEGgdD9tnEyfBuOEbBKFHj9b19jpmKzEgBUYxYBZecgSNoBG/6LztUfsi5cBb+qhqaE6OCSEeBnXWO5prGbSQDQIpEOmbxNizBegvGitTMJDxiQAHTWnu34Plg60Gx2xRSjEuU66AB6xt9B/eGohxMg0vjua0FtIr3i0gDe2uis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469668; c=relaxed/simple; bh=ZuL1arzThZP1bH0X88EKns0i/Pwsb1RnCMJkbCddCK8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iXJbbQpLt41isHC9KE0B6hmYTe1a226PKbPUXkcx8/jUWg4x7qvXrz2cjHV4gaHB5eZZnM8CPvWtcrZ/O+VmFvC79zxBfH8MLDj52/lMDbypptYXxjmmpFHKlmvrTF80CQkqdeyHQQtl6FJ/hg87NIG65CC4zo1tY2F/xBRUY6c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Njq+a92P; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Njq+a92P" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2f15dd0b489so55907901fa.3 for ; Mon, 12 Aug 2024 06:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469665; x=1724074465; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SQA/PjjohkpV6TqZg91y0zhylBtn0W2KyopE+/TT64c=; b=Njq+a92PA2Q6EkAKZRlyBDvjhntXSOHW7yyhPqZr39gEui1U7jcXKTLloxjXK+lGs9 jzUYSCheWK2tHZ1HvtN8FGLSVZK044JQodhqk3Q+VUP1Z1FDun5ZVDLR/eETx0J+zrwK RI//+AzxILVjoV4Pj2JurVAKGwymfx6gj4p/Of2COs94d1DSKz0apR5CdxJboGmopq5m xQveEk2VD8NtAXo8f6sYkzmi2oyyyScegRY3V8XGGkxTYa5nA4hU+aFGMoGr9nBvPK2J VQbDwL/hOwgiAW3kKgiQYvD46z3CNgQlQb8OJeIAbvhITlRZEz9hdkErLUyLIhGOwHf5 McNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469665; x=1724074465; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SQA/PjjohkpV6TqZg91y0zhylBtn0W2KyopE+/TT64c=; b=lcRcTau33HRNzeYzZtXAorUWI7Xg8wPjRhvuZcESNHnEzU6x7pLYUzX+laVd0Lpybg B9PO/LlU3l1cLUCgsINpwGCu49QCDVC3EnOBXKs3zP3rp+2wY2uQ4zAtUYdRJFBPtJrr 7wDhql2Gy7d/DzSHuGr4TgdW/NFhLpnH5K9NGApmvM9LzY6zLv7MJVOcTBspFHTiuVUx ObvSYSlpJ2lLjQ9+qdB7tLJfVgpVGt06PlngKckEso1EPHxDGrUCOzelcbkftgPip0Di scb+uTMQnYgXyAFJYT1i/vm4o3K8p7k8sBvLqGEksLE01d9fBlpOgowv47lKo7XG2EJ0 ZfUw== X-Forwarded-Encrypted: i=1; AJvYcCWyOQFImxDWqY9Oald9pxdrWZzz8zFhQK2QIRuCBgb8L0Jb/ZeuUZ7JTP/wQzxGc0hQ47NJm3nfaB2oRGyHn5yzQhn7hjUAlo4= X-Gm-Message-State: AOJu0YxkxE6TU28I2O+r6jcsC8QAX82QP7SBOhWGKwko2jwBQujaolk5 ERr32eEpV2ftMfdZucLqEKB+7LYS2m6du+I1WFbdNveB+dYKdlwg9SqkzpWrHGM= X-Google-Smtp-Source: AGHT+IFuG2qd+DzlKsP6QmlNw7cGw4vQwIOF5kCUyHlkAobIrwVs2DCtPwAfbJ5IawKIByi9iNKEWA== X-Received: by 2002:a2e:d11:0:b0:2f1:9248:c325 with SMTP id 38308e7fff4ca-2f2b717bb9dmr2097961fa.31.1723469664458; Mon, 12 Aug 2024 06:34:24 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:23 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:57 +0200 Subject: [PATCH 3/9] memory: samsung: exynos5422-dmc: use scoped device node handling to simplify error paths Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-3-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2782; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=ZuL1arzThZP1bH0X88EKns0i/Pwsb1RnCMJkbCddCK8=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9THrzP+A1BH/yeTSMDTHI9G2M6wGjffRCSn dlrxuuifPyJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPUwAKCRDBN2bmhouD 188OEACJwoc0GJ4OOrq04S9Eqnai7E1TmoY+QS6g/X4/oh4fUgYz6R5MGupwE7ya/svO86v4gOl OLe8SdJZKjvqK76134ROWFAUJfVnt+x5RIg6hxI7LsqUOCxd4+P35lymy4T1T6M1Wm1YD+bzZcT b+hJuth2lbekjBDszhBlcuwsLCR+eP4qOP4X60dIIz/DTwLKRIsNKi1ZzceLBcnU3FxO29VYJo7 gPDrthDsbabgcU/p+jDKZpqlwyVbYPGmOwXrB+qA/6UpNUkSgS3rEBGULDktmxaOWiCVYAf/uxU hnIEBvoqeT7dGdF/zxzP4IXa33L8dQ3nEhTktFn/KUFO7KSP0npI9YqxGe2wTq4U1Iu5Vv280pp ebL96l+uGfl7yGN0vm3XsrETWTo9jkdwTEC6nNhFbXQbMeZfppqiXSnheVM6pyTepzKzcHhmXOo 0BysbLIOGMoxpcppLMfsoaimruRVTEn8PloUDzWjtD16zDFGKzngIrJuXFP0QKUiK7nLK+tFGiT kt4gMkJiRZCBIxDLPT2HkMhtyfSZMcKX/sIsKruL/TqdZ2oD4zY3RiNFWtZ9NDMNRI2wQP/yB6X Jbg4bT8+JbyRvvxHwF0/F4UaF2Wz9fGUB/XnfSw5mFRgs6GJP2sFYXsymEwhYpm/d8s6rmdQ643 NIuOrNP6Z8e6AGA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/samsung/exynos5422-dmc.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c index da7ecd921c72..d3ae4d95a3ba 100644 --- a/drivers/memory/samsung/exynos5422-dmc.c +++ b/drivers/memory/samsung/exynos5422-dmc.c @@ -4,6 +4,7 @@ * Author: Lukasz Luba */ +#include #include #include #include @@ -1176,10 +1177,10 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) { int ret = 0; int idx; - struct device_node *np_ddr; u32 freq_mhz, clk_period_ps; - np_ddr = of_parse_phandle(dmc->dev->of_node, "device-handle", 0); + struct device_node *np_ddr __free(device_node) = of_parse_phandle(dmc->dev->of_node, + "device-handle", 0); if (!np_ddr) { dev_warn(dmc->dev, "could not find 'device-handle' in DT\n"); return -EINVAL; @@ -1187,39 +1188,31 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) dmc->timing_row = devm_kmalloc_array(dmc->dev, TIMING_COUNT, sizeof(u32), GFP_KERNEL); - if (!dmc->timing_row) { - ret = -ENOMEM; - goto put_node; - } + if (!dmc->timing_row) + return -ENOMEM; dmc->timing_data = devm_kmalloc_array(dmc->dev, TIMING_COUNT, sizeof(u32), GFP_KERNEL); - if (!dmc->timing_data) { - ret = -ENOMEM; - goto put_node; - } + if (!dmc->timing_data) + return -ENOMEM; dmc->timing_power = devm_kmalloc_array(dmc->dev, TIMING_COUNT, sizeof(u32), GFP_KERNEL); - if (!dmc->timing_power) { - ret = -ENOMEM; - goto put_node; - } + if (!dmc->timing_power) + return -ENOMEM; dmc->timings = of_lpddr3_get_ddr_timings(np_ddr, dmc->dev, DDR_TYPE_LPDDR3, &dmc->timings_arr_size); if (!dmc->timings) { dev_warn(dmc->dev, "could not get timings from DT\n"); - ret = -EINVAL; - goto put_node; + return -EINVAL; } dmc->min_tck = of_lpddr3_get_min_tck(np_ddr, dmc->dev); if (!dmc->min_tck) { dev_warn(dmc->dev, "could not get tck from DT\n"); - ret = -EINVAL; - goto put_node; + return -EINVAL; } /* Sorted array of OPPs with frequency ascending */ @@ -1239,8 +1232,6 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) dmc->bypass_timing_data = dmc->timing_data[idx - 1]; dmc->bypass_timing_power = dmc->timing_power[idx - 1]; -put_node: - of_node_put(np_ddr); return ret; } From patchwork Mon Aug 12 13:33:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 819353 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0AB817C7CC for ; Mon, 12 Aug 2024 13:34:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469669; cv=none; b=dGPL0RmOi7oJaZKP/SK0anurKjHwiNnieGQTkrdyD4TYGkcQR1p3mDpAK9pgQ+tEvi6e8cA01yr/M4VV4zG1/iJztUrHvouIjZc50CJp92b/+M3Teth3yORCaLQkGJS2kPIgc+mdiY6oNSqixo+nqUGelEUNuxs+VXXDkXOu5DY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469669; c=relaxed/simple; bh=h5GVRyPEyZM7BuYLl+uIGy5XE4aa3GH8V2JRysNGv/A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aTuRotnYjsSftFXiCMY3ZNzlplZLDbDI+bhDDjbIe4lPVwK/kmCzkybyK+Vx6IfCrNpwf5o8DuQIFjLjiXHuLbQGN5B3cBkLOw47aXuWZMY8UDHRg7bv7lDSnGj+KhPsGe9xiGi8yp2b7kASmi8Ll1X951zSjlfUqjaCO0cwSrc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JVu+Gb9T; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JVu+Gb9T" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-428243f928fso43314065e9.0 for ; Mon, 12 Aug 2024 06:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469666; x=1724074466; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=CxelJ2EbVi7FPWoh5bPyWxBtOLrcrZXgDmweNSFWgLY=; b=JVu+Gb9T2YnwV2e7VCdPafQID0NQhXmfyPKZqfwvGLJ14MYIfVbv3GMpnzuSgnlb+T OSXzTUictx7oLOMB/ykvp1371oO93jG9a+1GZMI6EkVScfGpnyu3UhEyY9c1a/cpGmfw PReoGF4o6uz2pn/P/XLXBaAIYoBzUdMaCzLdHZbX4dddwvuyttPItItgpCV5Iau9dxc8 TofpPBzHEfZ5BgiSb2K/aDY8lDF3R0GQz8ujyqolTi3JaasWBU3l3L0nA+Uv1JUIXvr/ M2+hsxmlaCecIeaXBOrzuYlbOAk0aoqFcH9i04TKqxFuPFo1e7VIorSBwYSJVdmtIVVR rM4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469666; x=1724074466; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CxelJ2EbVi7FPWoh5bPyWxBtOLrcrZXgDmweNSFWgLY=; b=vRlf9aPJR5eemZIl4oH1MLSSYrVJJjEZ1rFwnu8xYR1h2OekpdRtzM9rEKU6JbfS5h nvaLVH6t1uTntYPeMOhzPVil0/fEV+ysJM663waxSvs3K6sTdZe+IiXfnd7bQY4keWFm vLFzj+n00q42w/dPcq+0ckHQvAP2OAxJ6kcCqRf0/O58lOd1v+++9NdyvKW5wbQuQl3I OZc6WqBrmPNEVF2iQOLZI1o8EwuqB+ef24/iM+XNTNU05w5ChNXZ04SAH/16AkT8T5Hk +5TOFHLAU6D2joMPpCjhK4aOIZsRDEOZp8Io4kJVNtCIBAGrNJNLy7o0EN81ugEE4K0Q 1adA== X-Forwarded-Encrypted: i=1; AJvYcCWau52EobQUp50BeLiwBvxe3/oJiAtg5a3IG/xWomOSoFlhufsGXiUKurOs0dFcgnHPQHjAIoI+IAxo6icCSLNlZPZBvnkWmEY= X-Gm-Message-State: AOJu0YxG3AlMmbQ7e1xOh5rn04Z6/cNWqStxW9ELsFOlfR7MHc3knIyy jZI8Lg1q+Yc7QlH0JLrWdv8HgCFcd8Q/Q89D098W0ugOcQAvYJBWB/5Ga/eOuVM= X-Google-Smtp-Source: AGHT+IF/xqgp3fX5/73q32JxRWI738lXHcWaaxk8rQf5ZvZitjmwwt4tX7txoPGOt9wBMUleQlFSDw== X-Received: by 2002:a05:600c:1c82:b0:426:59fe:ac27 with SMTP id 5b1f17b1804b1-429d486efd0mr4284805e9.26.1723469665903; Mon, 12 Aug 2024 06:34:25 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:25 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:58 +0200 Subject: [PATCH 4/9] memory: stm32-fmc2-ebi: simplify with scoped for each OF child loop Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-4-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1886; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=h5GVRyPEyZM7BuYLl+uIGy5XE4aa3GH8V2JRysNGv/A=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9UQ2G2MLUWfrT/ljckUzPqu+/Ti/gpvU3bj vLbozfzG9+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVAAKCRDBN2bmhouD 1/h1D/9FBIcRGxE/iNnzoy6kaQiSTt/zZow9zS313YkYxSmkqUcdnFL2JyYULkVMPta7hVQ9v9O bZJQVD0bif8TRwAQp1cB71a4T1IENrkqzP4iwFZ8087G4vZ9NdHeU9aLruLynBs9/U631XugQ9o SFXgY5vliVBY1jbiRMwrIPbvEPecG1O1/TKbCJYd8ZhjkDXln2l1HIVce++fZhyE07IJqPqBnI1 8sUFAOB8Eme5pmhnTfeYVvoJ56i+shfDHmsBeEdwbG2M/iv38XN2rrE5+q79M5epLsDdyQr5doq 0fafsJQocAYUgPZVgrdmnBcjhb9zEKgFVsPdEXvdPU1QW4t1RvSS+RzzrLbus/05ljfhwM5Ot0K Z6DywmDKh3uT+EdqtuVpHhIs6rcfAKyjHyEPg4r++MXTNRVWw1062emp7mAlljObs/Tqllgiu78 uP9yE2NcARpF16zI4YXRDne98RDnw4oBeRx5oFD74w1SudLrioM1ouoFicZqJwMjrSAjuhcRb8K +dGLLs8fPAVE+GsBu9pu6z++punmdkhJfIqdCX1VCPrYHcYg0aOPPsaA2MgzrD9+gd5o0lRsQY8 BAQtw11HqnTQwABAZ1MS5FtvJDkJelkJxE9hWQZZskoCPIq6vj45Ab7Ud2anz27txnCtpZ3ZNwe CmOBzjUDD19MKwg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/stm32-fmc2-ebi.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/memory/stm32-fmc2-ebi.c b/drivers/memory/stm32-fmc2-ebi.c index 1c63eeacd071..7167e1da56d3 100644 --- a/drivers/memory/stm32-fmc2-ebi.c +++ b/drivers/memory/stm32-fmc2-ebi.c @@ -1573,29 +1573,25 @@ static int stm32_fmc2_ebi_setup_cs(struct stm32_fmc2_ebi *ebi, static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) { struct device *dev = ebi->dev; - struct device_node *child; bool child_found = false; u32 bank; int ret; - for_each_available_child_of_node(dev->of_node, child) { + for_each_available_child_of_node_scoped(dev->of_node, child) { ret = of_property_read_u32(child, "reg", &bank); if (ret) { dev_err(dev, "could not retrieve reg property: %d\n", ret); - of_node_put(child); return ret; } if (bank >= FMC2_MAX_BANKS) { dev_err(dev, "invalid reg value: %d\n", bank); - of_node_put(child); return -EINVAL; } if (ebi->bank_assigned & BIT(bank)) { dev_err(dev, "bank already assigned: %d\n", bank); - of_node_put(child); return -EINVAL; } @@ -1603,7 +1599,6 @@ static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) ret = ebi->data->check_rif(ebi, bank + 1); if (ret) { dev_err(dev, "bank access failed: %d\n", bank); - of_node_put(child); return ret; } } @@ -1613,7 +1608,6 @@ static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) if (ret) { dev_err(dev, "setup chip select %d failed: %d\n", bank, ret); - of_node_put(child); return ret; } } From patchwork Mon Aug 12 13:33:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 818746 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12106183CC8 for ; Mon, 12 Aug 2024 13:34:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469670; cv=none; b=KJfYs2co1zLmTbh7WqHoS48k2NOoQg57bTCosAQpN1smqc9oBZntGL80RE0PfpVDoogkTf31CWgv/TASasQ1c/79AhBwRnyweE6Co34wkUGcv5g/NWc5KDuK6Kxpwm5eSO9gR754rpQUizjxE7vvYSN27G5nuMPiPCC81L4r5GY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469670; c=relaxed/simple; bh=VUl2omx8TySNDGhRBBGJcq4Ai4teD6LWmoYd+wA7nBQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bbCrrFBsiNmVxoZ7nJDazQqiFIvi8QxBHmgWn1xFd799ZWlDOkgdb4Z+lh7p8kqT8MSSvetrZbETCG5f4gaHuv4rWvI1AJ5VhRFCVqOpy3tUUU9kU/hLtR+nCeOHZNhEVWv91ESsIkDkEleICaSUVHs1okAFFSCzZbDCQajMvIs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=yusXiwtA; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yusXiwtA" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4280bca3960so34146445e9.3 for ; Mon, 12 Aug 2024 06:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469667; x=1724074467; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iYu90t8uzYSzwZwxstiM099mVmkqpDjtdWc2Qi9XDBQ=; b=yusXiwtAYUSY/HwztYJo1NrXlymMg3bx7C0/zXknRwnTWSVVmr5VMLgUIhuotOXqCi Tsq1NoNwtNi72zJFIDhOugRosndeeKgFyqqCpzWiVkOzI54eHlq690QwSyx1oZdfc+nw j9CxVAQsLLTZQVhx8VWbksVYx4PLMo9552bnrVz8MCM0XFdLitCB7XTKNbzZV66Oeraq gjsixjwtC5BKVTLicTzdlxuETQfYKoG21DhcGfE6lKjzU1hnxfbzKyGpYxBnpLzbayAC aJwePxF/Vorg9pvj+BkEtCwb6sQ1PtAlzV93CRc3rF/kh4VuXJxwmUQjUKftG2M5J+sA 0A6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469667; x=1724074467; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iYu90t8uzYSzwZwxstiM099mVmkqpDjtdWc2Qi9XDBQ=; b=g/Cu8N9rxXdrxkTqkX/eacwu7MzDUkX2mJtLXB1kMw/QjKTNrrpypU+tTtJJHYSJ3h wmsWqeYNTY6GHvlq+9L2Rs9qbfGZQGMRwucGvsrE/+jKZoJKIdIhBIuSW8zGaxfFJPq6 fZZZvvdrl4ihOnEceU8y3XzSANb1em9LCQOlYL7svlD+4HOYDVhFs8s+syyHmJrTQDr5 vaG0GacmYJLkTKGafvddOMLGpS/p9bnq6FR1R+N2nMXfAONgxCQg3/2PeEAF1SgnIOz9 y3BoDHfSa7cp44peFMtc1hOQotPxjYshHkiHS1JdHYC/2tGlQXqnpxbOFryK6h6iZa9I xeag== X-Forwarded-Encrypted: i=1; AJvYcCUOk1m/4Os7ka5woyNH/9qEVh2qqzfptPlVa3AVP4wXCSDQAMzT7r3pnkcICzuJibzbxDrRDfChG1lJ1KwQG6JHWhMwjEoZO1A= X-Gm-Message-State: AOJu0Yx9SgZZ8NpcI0sjtvUMWWPTIHAwreekOASXgEvoyWsDFNytWcrR P/+7BsIAcVnV9UWZrQFo8Vt49wVZ2S0vG+dFJZd86+02EE0+0JRBXZFFvGp9o8U= X-Google-Smtp-Source: AGHT+IGo+bwIOsZ7HKzwRQ/L9wxhGpzJ+9d90EvUl3/LSZZSk74iCon02t3qgWPnZGmK+APviAH8lQ== X-Received: by 2002:a05:600c:35cb:b0:429:cc03:6450 with SMTP id 5b1f17b1804b1-429d47f3d65mr3847725e9.7.1723469667400; Mon, 12 Aug 2024 06:34:27 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:26 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:59 +0200 Subject: [PATCH 5/9] memory: tegra-mc: simplify with scoped for each OF child loop Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-5-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1844; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=VUl2omx8TySNDGhRBBGJcq4Ai4teD6LWmoYd+wA7nBQ=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9VH3wPyjxN/t/zzCvyjeYSsYVX7Jz1ga252 UjCTUHqiJ2JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVQAKCRDBN2bmhouD 18dmD/0ewHA0UK0In5nae64KOCy+CAeX+7EsnZCjszXwHpXtbtbje2b7d8Br0Rj7OsxqkLkswiK 0TtfIJ7JhGZMAjZ++tIyxg3wlqEt35RQt4H+PQvHeDLM2XZ+z9CKTc05uuZqynh/PpvkoXHheOr lO8TR4iguvJTFmKmbSieHEgcEQvDqZL+SnWoADGWfaRqTpuCvzgMMuf+2qPqqnDNfcregG9QgKO +w60nKgkB4CLB6FMMlzAscW23AprITn6TCuZEBd9s9Ml4+hp/NX2QJa/E79ozdZpjz/6nT+JZi2 7QUvHO4EcccyTIqhqcC1Ggezg1vmaglKJdKUI980UDR6GarxWnvJwrNaTIjoOvUnidQNMAbw1E8 Brc88ThoerIMUAaRW36EdH2jze/ynNoiK+qJUZnNdlK9k2d+ApRPCR0llnQTKj7OKVxe92jKUT3 GEYOBQ1Vf6C2aD2syu/gERy554GaWVbVPHBmvlGYFw8VyyirnITcYyw2ElKoHJGTTySSedZp2Uh TUCYUuos2eEzx/EOV9E7LDPfrFWARV8lZefX+nMIUZnYSj1WdfPfKnxWM7S48WuUkXVDaHSNIyz hYY0EVe5bcenb3qyxNONkHg0IKjxWPKwtIzWFh31VxXLQoZ9VXrteRJhyEqthWTt9f6GZALFo9O hWEevbAzA1E3pYQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/tegra/mc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index 224b488794e5..bd5b58f1fd42 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c @@ -450,7 +450,6 @@ static int load_one_timing(struct tegra_mc *mc, static int load_timings(struct tegra_mc *mc, struct device_node *node) { - struct device_node *child; struct tegra_mc_timing *timing; int child_count = of_get_child_count(node); int i = 0, err; @@ -462,14 +461,12 @@ static int load_timings(struct tegra_mc *mc, struct device_node *node) mc->num_timings = child_count; - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { timing = &mc->timings[i++]; err = load_one_timing(mc, timing, child); - if (err) { - of_node_put(child); + if (err) return err; - } } return 0; @@ -477,7 +474,6 @@ static int load_timings(struct tegra_mc *mc, struct device_node *node) static int tegra_mc_setup_timings(struct tegra_mc *mc) { - struct device_node *node; u32 ram_code, node_ram_code; int err; @@ -485,14 +481,13 @@ static int tegra_mc_setup_timings(struct tegra_mc *mc) mc->num_timings = 0; - for_each_child_of_node(mc->dev->of_node, node) { + for_each_child_of_node_scoped(mc->dev->of_node, node) { err = of_property_read_u32(node, "nvidia,ram-code", &node_ram_code); if (err || (node_ram_code != ram_code)) continue; err = load_timings(mc, node); - of_node_put(node); if (err) return err; break; From patchwork Mon Aug 12 13:34:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 819352 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E6B5183CBD for ; Mon, 12 Aug 2024 13:34:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469672; cv=none; b=MPPN4IquUU5rGlratJUOXotlaNV3xQxoN3TXpx9+kyinLp3uQCM0+Zgn73OSztd5LyY39aPc6ylpaeTF/9wLyo0vDgxNpeTmNQDB27zqGx8Dd59nGqNXnWiJfBuUUUAE483jkGoEvBUSEqNShRbbiA0eK80ZlWe9u0Oi8afhr2c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469672; c=relaxed/simple; bh=IlxS+D8E+Bo6nHEepn+0mTB7t42TrSmGndFVSzcMSuk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B1FCQJJYo3KeDieWyIWvNw4ORdT2X6Zp+bpXtm9rDWANZ1BlWNrJYX7zujVnQ1t9k1MjgGsZsZcnlAmr3Il0rTYxwEcJBc2raQmK26K2HCgYiUX9KM2NNLI2gEdtToEGbID5FwT8e4ES3+dmr4H0fSiIr2xeqJJ+zAtoXrzmKj4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OG6wDyTa; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OG6wDyTa" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42817bee9e8so32732485e9.3 for ; Mon, 12 Aug 2024 06:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469669; x=1724074469; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2vRtjY9RoJ4lkxTaWAaQzIhkuMec1ZzRbTb9Hn16sHA=; b=OG6wDyTawd/3werPYRuF9y8q0ToceWZYEzRt4u00yzLBDlZCr3Eio02O9eU8/CKnm2 uO4MCfjSXLm2+5aBNFscI5wDkXrLAyJ1q7GaYaTDngRN5Q1iCwQc+h+PlywjD3VKRJUJ kec5LTmq3BRx8nCcHcu+nQGd2FBCA+XNmLiYBgd/NT7R0QRc2Wf02PnmVfLdTYtGxxC9 vCDdztXill5VdbdqXy4h/36/agwAIDd56K1+5QjED4fkjWGcmZFPeO7uspMC3xTgJ/U2 FjJFHw/W0U9EmD4cw1Fz4QjGepCxUkJCtq0vp0qa7lq5XdcCSM2HkUD0VEo4PsGwuQqZ HtvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469669; x=1724074469; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2vRtjY9RoJ4lkxTaWAaQzIhkuMec1ZzRbTb9Hn16sHA=; b=L0R4m+GqDWJK0ZFnulTT5xsM/KfEyhKQeF2DuX8pxNrQJ0YYUNuJpIDbc8o491vD0e aMPqogq+gMXfh+9LQ5HxLPGb2V/Br6QlrszInEp8ZGDEJiJMYt93WAh7DLPzN8g3mYkF GEBqICkGmd47vu8qz9TpOm1DXeNSU/xtuf/hlnJU07O1Fs8U2kBj7VpIXAWKIE9foHPs 5aq0F5fugcbcrI0iwKbkLT1l2vcVbyX1qQC6CycdfnhgCo6DPnPSN1rJE1dhMCAj1W3W 2isxJqRwhDmeD3cmzZOdlyGJX+k4dOvTpJRXUDRRXVZYLn+5PgCAn0LD07t0pmv21QWv HgUQ== X-Forwarded-Encrypted: i=1; AJvYcCVb8WdCz3PxrZN8OT7941AxZok9WGK/fTWGJXH8rT6LimI4Xf3ng02yFd/I/ZGDCIER/SQRSZUYjy1zUTSObLJxPjcFAb+yC38= X-Gm-Message-State: AOJu0YxQfrB2+OGRY1jOR8JX6VAcforceLHvRsHe3X7NFCWEkHYGuJ72 /ad+OKRbLLYkTmOL2H4uFGKX02zw+IJUY7NEThOopoAKA3yCVnfCYCRS4NYKqBk= X-Google-Smtp-Source: AGHT+IEEUwAlG76HjxJAsyK8S8T/mYq4aEjAVVfNn3IzdOaUbHmzoELCalL3YkqLxnDddPuKFudeRg== X-Received: by 2002:a05:600c:138b:b0:428:10ec:e5ca with SMTP id 5b1f17b1804b1-429d4801e5dmr2984845e9.14.1723469668894; Mon, 12 Aug 2024 06:34:28 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:28 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:34:00 +0200 Subject: [PATCH 6/9] memory: tegra124-emc: simplify with scoped for each OF child loop Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-6-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1246; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=IlxS+D8E+Bo6nHEepn+0mTB7t42TrSmGndFVSzcMSuk=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9WY865X4GH2lunkVHCyM14mLujFcZgf8J78 qI8SrlTVxaJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVgAKCRDBN2bmhouD 10aeD/41meg3/8L8q4GOxl5Jxe+3hlN0PEmllVJ2SQY0syA/bR9hZ5HnHZrvd8TUzKepy5Pr/iy SDdFyfaLYElBSZYUrpBIJ0eSCjbPuaUaT3FfClCW3EVZXO+OxFPD/NC6IY1HJyaiegFT0SWc68G z7Qa0sL2FuqN0bItr5eRrGgOAN+nscmxIw4WqKd7VgPoDTN44IskG7JMI/CPEnJuGPhY5xqzCfr iYjP38QLXnQz1Qh9LZdeRg8hS+5HkEwTaqNoBE0kd3JiYjkxdR/5GUQEWeit8zufS8B1DM4/Rc6 hQSZm6PkJDv9n5P9hLBD+ufLVQKJdYdfJVEC8iraYg/e06vlLB/elPsn/+qb/yM6alFuOb8AfDd Fi4yVboCoRyJuvc+V7wKvfz/TcqI2iqSmJNaJmzxtFeNxbsIp7lPMD8LyxYy3l3xQXW5DHKaRvA z6JJ4JSxAbNYluLpGBJZCTHl+fIUhU3S0CgxZH5GNnIgvq4Rf6HgIZIL4zky6HtPopfmW9TQAvH M6qgaLDwO8DwsDv5Bw1IF3VS0SxwBLiWxLQV1iVKRJiXcpLhDUReB4QFLv1X7ycVnOaouhNPrdb eavRIJkAtuQb6YhgpqUazX1eq/fCPLnT/sCa0s59ys02ye5w9qbbg0GqzWnGenksh6pnzHYOsX7 fBP6UmhbugpR3vw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/tegra/tegra124-emc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c index 47c0c19e13fd..03f1daa2d132 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c @@ -992,7 +992,6 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc, struct device_node *node) { int child_count = of_get_child_count(node); - struct device_node *child; struct emc_timing *timing; unsigned int i = 0; int err; @@ -1004,14 +1003,12 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc, emc->num_timings = child_count; - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { timing = &emc->timings[i++]; err = load_one_timing_from_dt(emc, timing, child); - if (err) { - of_node_put(child); + if (err) return err; - } } sort(emc->timings, emc->num_timings, sizeof(*timing), cmp_timings, From patchwork Mon Aug 12 13:34:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 818745 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF63518454A for ; Mon, 12 Aug 2024 13:34:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469673; cv=none; b=k6E+GGJiBUKFQU28JLF53934H5DRFJN7o40f3wRxGlueqzN5VaOugDrW7ZXAvKa1fUYrMv/4L6EgYxVErh0TUs5hHzcy4JLMHxlA7XaNKqfxR0u+O66iOjuRs+mX3+CN86iy7qAQ95cnrOpva/2LRLq4q86MDp5JQUE3SpDI1a0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469673; c=relaxed/simple; bh=0agCSQdAmRYcJrMldLHC+cO/HYUzM/jNOwE7xvoTJWs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aAYaBWdFREU0CYGRNk5RxrgMNxZH4HEYFOt9enfs1ZoKnt6ZpEZ7HZ8aR+6Q8rjdnVxa/KjhwoytHyn8otp7O8T8TG1WnLXAGYxEHIv+LKZ1YuBQdt3GSSqJkXvjNCZoBjGDMeQlpqXpsfCbbOFn5Hh/tIOmnCONjcKU/jyvD3s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=x5/EoD3p; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="x5/EoD3p" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-428fb103724so30362725e9.1 for ; Mon, 12 Aug 2024 06:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469670; x=1724074470; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HsPnMwUlmEcWVK9mERUpPYYwG4/ZxKmrdaWPZk7BfDs=; b=x5/EoD3prrcyXNazsILQ2iNFnFIM2mAvbTgykwuwfMjS9RQ/MlZNJDUO4dgdOC1GDW EwaK91VugvWuHxLefXM5UY5M5sUqW+BrXSoC8yZAhrh3Cpv8rnB5cHxXDoQrTrOxDNQE lAoJpOgMxdBgPw3kkOCFHuiTTmnNVfAAQlSwJRIJdnAD5K5gMjHqCgEdpvaY+H+fp2fO Sr6lvH3oA4urFP/Lh9nHyFuPfE7cJo2bunQiVIzjD/DnFJjyr149E3BZ7O4gOD3KEh45 HAjAkwZr57lgDEjUO0ydCw2M31dp3j8cOK5cFYmcMMxf1zuoyhtK058x3+jACGQnivzg ZjNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469670; x=1724074470; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HsPnMwUlmEcWVK9mERUpPYYwG4/ZxKmrdaWPZk7BfDs=; b=li5NAhHh4VEeoHUZG7zr+b+YIVcPDLAlmYC0SMo/zEUonP+mZUJJNIvXctGTuD4S9j MeQBIjZnqc4rPLwZbLr7cIqfflvC+UAvW9cEtASiCw+OEppKgJ0155WgAFP599je8ZxJ lpPu5MqbMpt5Zz7IsZySU84E7VQ+ti/W3M9SGdFmOaxa05zOAYQVP/wjvEelDHD9lG8g rXQiVn7c3O1SHvZoeJgRlj0fG98omEqexkwEzr1lrg4bRteCP4rtnlTdQYZHsJrkI5jS /kbbrxCsAORSCRuf/afVSw9xVCxBpCuzcTGuDME+PY0GMLV+u9nJsEZ73vHGZ1exT69e gkig== X-Forwarded-Encrypted: i=1; AJvYcCXxbXKf9WRGRYcaDP6MfE9oX0rvnGAZarVEfFskbtl5rHVVeonUwGsHa3HDPqQksoWw9mC2GrNhzcHf7pAIKMpwz16BcyIObUA= X-Gm-Message-State: AOJu0Yyd6BfTsOT4jHhymuSONDlpBB4jTkzKGt9mOl/KxbiHkRCUHy+M 9E6fE0HTyLYtlxO+Bu8z4zNNT0A2yfh4vQOyQD9qGug4r7Pyr3cdCzd7EbHTXSY= X-Google-Smtp-Source: AGHT+IGNiDAP0NpC4elbocTXmRTxZwypqEwP2T7NoNQBek7gp6Czs1sj30tLHKhrLESNRMviHtEwcw== X-Received: by 2002:a05:600c:350a:b0:424:a401:f012 with SMTP id 5b1f17b1804b1-429d4ce06abmr1140655e9.3.1723469670362; Mon, 12 Aug 2024 06:34:30 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:29 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:34:01 +0200 Subject: [PATCH 7/9] memory: tegra20-emc: simplify with scoped for each OF child loop Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-7-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1217; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=0agCSQdAmRYcJrMldLHC+cO/HYUzM/jNOwE7xvoTJWs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9WsUwse3YgLVrnCc6/fae3A3AcursWIyaSR hcKG6MOheaJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVgAKCRDBN2bmhouD 17skD/4mk0mqH2rEuc6Lpcv9Fk9Z9Ofg651HdFCPIT9SXWaxdSmtuzFF10HgMdna2jAU8gVSx5a teBho/PIDCcTaBnRl2nfMGaohe9F6FvBXUBt3gyoUK8ws7VHkvJDSa/KJPlwupUztYS3WvUSHFJ /EKc9LxNYJ8WOl4h+a0KHjCPQTOMJphsYrmP5wO1v5mHNoWuBnbxURpMSzEe0EXtHGKbL7ftoyN V/BvKwz/AlFcGp4vn7CRcjByp042rkUjWrM5C4QOffDdnaEVCsGlTdPd+Q9j/oGG1oPiwjNj9Rk EJXOpzGg5QR2OlVBAR/BiPH/O17Zo3xLAKEYGwnEv+9n5xQfoRhFkU8txLoW6kUVxO5EHRHQ9Iq VYYUKRr3n4cNsQXegkWk0h9MKqG2jWOe/sLHWWTNQTxBLqOo0PtVSqPwNVK0Yo4xadzdNZ4B/xJ DVjB1RIhzwfhUHHCqwIVYmOMmTnMUTTJZz3r3S0skj4aAHPWpyPj+S23pPD8bzAWFXDWETY+Vsy Qk3XC066YomliavGy2tfSIyRH61lPSAHFkN3db4nQcAqKVS8DlXh1sFwiBMUK1q1oAPQGu22y9J QwLihlnuAYhwjSTYotz/5tGVxKjNaIefeTjk+X+fU46eFbpPJpU7TYmqN7iQqDK38/OJ8k+YGO5 /7zMI7a8ZaQdSXQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/tegra/tegra20-emc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c index 97cf59523b0b..7193f848d17e 100644 --- a/drivers/memory/tegra/tegra20-emc.c +++ b/drivers/memory/tegra/tegra20-emc.c @@ -410,7 +410,6 @@ static int cmp_timings(const void *_a, const void *_b) static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc, struct device_node *node) { - struct device_node *child; struct emc_timing *timing; int child_count; int err; @@ -428,15 +427,13 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc, timing = emc->timings; - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { if (of_node_name_eq(child, "lpddr2")) continue; err = load_one_timing_from_dt(emc, timing++, child); - if (err) { - of_node_put(child); + if (err) return err; - } emc->num_timings++; } From patchwork Mon Aug 12 13:34:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 819351 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD95B1862BD for ; Mon, 12 Aug 2024 13:34:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469675; cv=none; b=g/jYpBklvpsK9aZmimsHJ0aqSwRImlI8cxSgg04ukBQUARLhWmSDA1UhruIvpEypioEPEEf1/RTIQJX1/QU67lEf7wilvfNc25S+B93G6Q5LPKyfzpXBbUK97M1JDbjk9dONskIGHP8h3++igxzcw/nwyjnoEQT1Zo4rqeIwuKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469675; c=relaxed/simple; bh=Qm8I2XYrN4e568eaRkgeUjoCW+fRdkjecwXHEHRljxk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aYCfDx4bQddLvVQ+89Xmwp2rLy9k4Wq9W0jSbD0/8LH1MO4bsnNkzVL4QMHNrPn2uXb3zuamlqPnNgQ/397mdSATD9c5s+ZfKL+/z1JaY7mtVV8BqDSKSfB9waSVxzasmtyQYlL7s5gE/LTcBZmNsuvtRaFoNsN5uTyHgzGY4Zw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bGSAJ33P; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bGSAJ33P" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2f025b94e07so50635361fa.0 for ; Mon, 12 Aug 2024 06:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469672; x=1724074472; darn=vger.kernel.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=bGSAJ33PZw/ZPt8758fYkBFxGpXdxlWUS9X5ZyXHp0/htCwjHbV7+viaKHAUAjteVX NjWt3BVVAUXk0Am6YtXSRRjPEeWy/remdNj+iVO1iMa7oKbH+b2iVtTxqjucZIkeaHXD Oy3iDwLHj7wBLcd4CmjDQH081gNV2vR7lWc8kiL6AVyMk/mxHZ9Mv6dLJD2kOOGn+wCR mTV/xW0/MYkU27UpKdcvwcCQN2rSkVOQv8gCWbu4uPVUTiXpS9IoPzm1vbFSTiuB00nH wqXeVLfzJlAhsMpS7n6no6Yh/x2BJ7rWtjZ+5u0kOpRZ7s7+dz5rscbX73wrAEm7T+7b C8kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469672; x=1724074472; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oAYRAyLvoG4oyvTDF3Z4505Z3pwRnY5SCeviwv8U1gY=; b=EwTcS5xULWqD4uovQAmXuXhUklVHvW3W7b9VqhRypWEFkK4VGKmCYV+o8Qg/tK/k8C 9tn+Fj4PDhT3tGBLy6IpKsK6r+cttSnb0GywGR3VYBjup2TDoja7Px/098oo18xODp0+ cYzeLqraXMxnNDulYXYSWAd0Ok1DLJdDMUy6cktAd+QOIP1yV7pcZEBQUupw7pyEhJbr hMwKDp7J/FB8oXw0VeigaHMppnGjEXqRf4Qz8pP1vnVphUUuEgSTwZmD9AB7u0dU8jtO Hsx37eWZPQ68NmCee35pYx3dsNW9ZjXiVjKnA8CmSoe7DqRWGa0PGb3TP7aQyIDOUIZL 0eSQ== X-Forwarded-Encrypted: i=1; AJvYcCUp8YsKDwhHotxULRMMhJG8FpOqnB+8yvHtj9v+PKxR7aOmbEqE7qi8W10UuvA66NJQMT+DHphTl9RikseDtVl6AsAC7U6XDwM= X-Gm-Message-State: AOJu0YzMDRiDYkhry3ZCgtBdeEF9tVHFOzOnSwDD3TBxa5JHDyBWRAmy YxJ6JGkIO+4pbpJ4tAVMfzYiGGzDSArvY42DRXddCVXoM0RmKdfJMrSzo18M/AQ= X-Google-Smtp-Source: AGHT+IF4Zea8h7AbclFyhVQtS9eZT2Tc6EMfJdGvwHFdzc3KpbF32S6sd5GGemZ+KlUJ1S/LzaVfaw== X-Received: by 2002:a05:651c:b29:b0:2ef:2281:2158 with SMTP id 38308e7fff4ca-2f2b7132d7dmr2306451fa.1.1723469671912; Mon, 12 Aug 2024 06:34:31 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:31 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:34:02 +0200 Subject: [PATCH 8/9] memory: tegra30-emc: simplify with scoped for each OF child loop Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-8-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1224; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=Qm8I2XYrN4e568eaRkgeUjoCW+fRdkjecwXHEHRljxk=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9X8NotaoXkCeoFvECQEThprz5ONHsMuzD7b NbNcj+DjQaJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPVwAKCRDBN2bmhouD 19OvD/94A99rooiagSr1yUUB3q7Tj/0CpbQTlx8GEwagkJMZgezQJ8fSt8lsJRwMBXaisbT1RUu /ugtoQOyBWqkLkCZWhr/dt2MLe/xTHkqATxxMe/q3D+SgaGpBqnpb8s3OCcUoLRH2zLUgkSNI/B uuVVzd55ascHajpNWi6sBkx/4Ze24W/M4Kzrur9iytpTE0r8vhXx66INDaF8DWK1OKaSFR5C+87 Xi3jQE9JUlz3sNAXyieSjga2IaM8ORwSZu5uDrQ9H5dih3U5zFbTcVXbvZgWBaehrOS6NJfiCd8 SzqME8XywWSTxtLCXarn4TdGn3FqnR/O4walESXFoC2LygReE3WiwB/R+ZBHx3iQ7m+4NGDKZK6 VBpdwrbh0T3/x+HpB1Q1KJZvfqxuUUEOFea5K/1geiiMiFJCWOk3r7PxgZgoHWn4SwuTSHrvFYI +219oxZut/xhcq+BqRzL/oR4EZ9TyOFAxpt7eqTU670YOGIom6tb2FG/KaN0L2UuCqlodmYVNsY iJbDxcpq4gIrMimT2QT6S+AsS5JZAIV6l0Rg+otm9KBlrSMLK0JFVzGsM/vcvY9suDvqXV0rtwP LNsXWOvL2mgzo2mkBI5TGQ0g7g9fhaRALj9GU1rbiyjbDY3dZneug64Vgj4jUmWBINShFwvH3ag Y/cmVhGViQKghBw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/memory/tegra/tegra30-emc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/memory/tegra/tegra30-emc.c b/drivers/memory/tegra/tegra30-emc.c index d7b0a23c2d7d..921dce1b8bc6 100644 --- a/drivers/memory/tegra/tegra30-emc.c +++ b/drivers/memory/tegra/tegra30-emc.c @@ -979,7 +979,6 @@ static int emc_check_mc_timings(struct tegra_emc *emc) static int emc_load_timings_from_dt(struct tegra_emc *emc, struct device_node *node) { - struct device_node *child; struct emc_timing *timing; int child_count; int err; @@ -998,12 +997,10 @@ static int emc_load_timings_from_dt(struct tegra_emc *emc, emc->num_timings = child_count; timing = emc->timings; - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { err = load_one_timing_from_dt(emc, timing++, child); - if (err) { - of_node_put(child); + if (err) return err; - } } sort(emc->timings, emc->num_timings, sizeof(*timing), cmp_timings, From patchwork Mon Aug 12 13:34:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 818744 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30E04186E40 for ; Mon, 12 Aug 2024 13:34:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469676; cv=none; b=rnJAmu6jmCV0ClgyVEj4Z9g4SpYKZ8/m3YxtTP6UEl6IZOMGgbydL+y1mjqtfo8xF2KvDf36OeAe8jXZMTsndOiMQKHwyL1fJezlueCm3lYc5qLLvz6XuGjZCgBCNepKVz3YiDQzlwV+ITgdbtyZ8z9z4/rWsKMQoq9IMI3H/fQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723469676; c=relaxed/simple; bh=1y9LIZ3UpOVR4pnvMVqojw1S5Kf9CAK2N1Et998QgxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oUVyMBg78b/Z8kMCQJOA6W0VUhks9XLSvG1v1h2jnJF3yGvEPjquerBBl74ZRqTf5VrxX9eaIQ7Egry6Bu3cXOyqpsKiJ3RFBpw0zFD1HV0b6nj2xTXnJGsj0Jzzmj8t0ysYgnacXUH+UHwDWrjqMXRv1ntqq3ro9aiYgisuaHk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=RMDLQwpb; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RMDLQwpb" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-42809d6e719so33280545e9.3 for ; Mon, 12 Aug 2024 06:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469673; x=1724074473; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KDjln6hpCDXYJ0URbIXokRubyMBzSip15NzhUO8TB7c=; b=RMDLQwpbrNYeWvYBBG3wQC6alJ4BkDSartO7T38R+n2++6HF/JN9IsebeYdt53/0cE MQq003aOzYm62OHOPcNt3Vbp48zTXhnfGb7F1+1Ov+58NOD4KJY1hRGuwMhoHq/26LQX 12sdBthwH2tNzO9MqElsSbCp0vTgswVlWbeUFTMweXVZIBkj5LCJsHKPMcA8Mime5wD7 +85dbPCoX3isZ+o0zpNrZfXiNdDy1UkdAbjdZeAeRJTSAFP5CDHYoL34NQkxyFxBjywS vO6lcpJ1m4rTVFAudr+t9sVTYS/1evWwD9k4cWw2VjpGKuqZwdTVEgq+tOpgzgUa1ZU/ aycQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469673; x=1724074473; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KDjln6hpCDXYJ0URbIXokRubyMBzSip15NzhUO8TB7c=; b=Ya24dajpXE5eOcG7R9q0CvgiZfMDZr9F8EELb+6Aze52c/JK+aCuo5mJswaU+xWagX FMSIjCHgiQ8yEPqyQSrLoiIeYZAGAjW2FrydH8dWIzm2yhCYwaGEdgpxjSmajtF4cZX8 vkYbkIbAhC82caMPg4LIFtaigO9UDf+I6ztfGlbVYXcDDyC9fXkn7pBbt6ioUE1K8hXl Z1YBa3oLwJwlU4QxQ233ZVw0fOpCz8eTMosQecq5ivlvziN7kkCuhZTDhl5kllTAmuEY 0+4pZG2Bgp2z+LvWvmTDNkIpuEmR7dq2Hkstit9NG/U0vJbXjBFd+DS3Me5qKL5NmQEX xwqA== X-Forwarded-Encrypted: i=1; AJvYcCUXxp6Ft6mjKtN+gOGTqm8wbmh32BBzcazkQcgqJHVPZ+tS/RIpzqUqLlcyKjsqaBA/kxDdeuyyAaHqfTb2exY9cZQFv3d/kOg= X-Gm-Message-State: AOJu0Yx6H6pQqhPhG8jABtSazMcuhBq3zODYvniccpIheFI0lFEdYkS6 D53SZ5wX4UC3jA+v+YVgAgvTJ1bMW8WefqCs/7+jRgezEzr1hAH1/4Rn/JTirjM= X-Google-Smtp-Source: AGHT+IGxNdfGFBc2sd+uT8Mshv7zE0iMHxVPPRhCFdm+enI7xTfevgaIs4pdgcrzguVgeuzP0FcuHg== X-Received: by 2002:a05:600c:358a:b0:426:5269:9838 with SMTP id 5b1f17b1804b1-429d47f43a1mr3753855e9.4.1723469673377; Mon, 12 Aug 2024 06:34:33 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:32 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:34:03 +0200 Subject: [PATCH 9/9] memory: ti-aemif: simplify with scoped for each OF child loop Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-9-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1869; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=1y9LIZ3UpOVR4pnvMVqojw1S5Kf9CAK2N1Et998QgxM=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9YQQCkCmD6RWyldjxAxJ+p417Q43d0hTixW dLzROOtWr+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPWAAKCRDBN2bmhouD 1+nCD/9WeAq/6x6IjpXwsbY6q4WpzSCuLIsFjo3y8wWVAXieoqOsqOZ33OR2zlrlb5R7xqAmLOk n+hWanKoaIz81P6uaaOV4ADrfzpSGO3F3pljzOFcC5kjgcvvPffYqPKATl5sUjzZNH+GbX+OJRZ 0av395if4QbFFVZNGRncMfCo2pB8HZQQawKOrIVCOPLzN1l5iqgNomvHLRDECCa/i8nCeaWlmi/ 9UjCR9X02xh/BxZW74SjO55jI7IqLA9ohbA/OOGySP5UKVr42BoPn58P1GXpkfY6FZA+HZZ3ZxH v+AGb+6rq80Wl7Lz7DM4tVc3RniN66Yw1veXOM5c0CnQcQHGRGJDD0PV1Mm5Y/UEhTzsYmy3srt a2GcSDTHi2UlW11x5nxxS3OqY5xQ0lPmPn3y1UQ34g+x6gZpPZIQ5sRbQBNisH0kkU20pL32Toj vJG2V8EcF8BgyExdqs5VwUIyMk+IGrWmq9XPpedyVUo3qSrUBR657572wxtDIFSOEkJ4sPtKxg0 j3AB0xCbvaDIJIE3xaTuD2DMCy2Tqf/EocjX/gF6//BfmKUbuQQUFxqm5UCiuSihYMtB82scL+Q uQzGTpTFXzJKJUPlJUNaBiagiaOp0EoNTtbPKrmqybnQqPkBi7eMW/iiBy5E8nu+QOfyqv/mAoP uWIYBVUyjipVCyQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/memory/ti-aemif.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index e192db9e0e4b..cd2945d4ec18 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -330,7 +330,6 @@ static int aemif_probe(struct platform_device *pdev) int ret = -ENODEV; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct device_node *child_np; struct aemif_device *aemif; struct aemif_platform_data *pdata; struct of_dev_auxdata *dev_lookup; @@ -374,12 +373,10 @@ static int aemif_probe(struct platform_device *pdev) * functions iterate over these nodes and update the cs data * array. */ - for_each_available_child_of_node(np, child_np) { + for_each_available_child_of_node_scoped(np, child_np) { ret = of_aemif_parse_abus_config(pdev, child_np); - if (ret < 0) { - of_node_put(child_np); + if (ret < 0) goto error; - } } } else if (pdata && pdata->num_abus_data > 0) { for (i = 0; i < pdata->num_abus_data; i++, aemif->num_cs++) { @@ -402,13 +399,11 @@ static int aemif_probe(struct platform_device *pdev) * child will be probed after the AEMIF timing parameters are set. */ if (np) { - for_each_available_child_of_node(np, child_np) { + for_each_available_child_of_node_scoped(np, child_np) { ret = of_platform_populate(child_np, NULL, dev_lookup, dev); - if (ret < 0) { - of_node_put(child_np); + if (ret < 0) goto error; - } } } else if (pdata) { for (i = 0; i < pdata->num_sub_devices; i++) {