From patchwork Mon Aug 12 13:33:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13760722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A950C52D7C for ; Mon, 12 Aug 2024 14:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=VcjWHdiosHcY+6S2D0O17zgqYs HrARpLlwVCh1xle8YISDYT0s+kiGR5EC6u+viLCLDyPP6Sypxbz7HKKF7Z+MX+mbh5ZLOjQuuYyWg +XvhufMFAQ4iQQWWELdqDznSOBEVped+fJnMWXby7mOAmjlZauNh/wjKPJvYhWB+OW46g7QZOFRlz lP4uanxBcgsKAl4uBYreKAUNXUVt5KpOKuTxpXLZNXPIElLNtT0MxqUsQ+C5r6id2IaB1vJrXNiZ1 lHtsZQFqz5CAJNy8KS9tZKuJeaYCuQyh8o3wbYtWwVG0Jb3qrE5KRWnTSfhvsPlCYvCsMLrX0mvXb zGZvX8ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdWIW-00000000dCy-0obH; Mon, 12 Aug 2024 14:45:24 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBt-00000000R7Q-2Yjw for linux-arm-kernel@bombadil.infradead.org; Mon, 12 Aug 2024 13:34:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=bbrcx/BiY7bC2Z6/9Y1B/ajoR4 jREZoCgR1Aj+vI75l7IXOdHCRhQ8YWR9DGfIASuRVmAUrCo018k8XL+YVnDLztMBwhpBGdD4Ug4uS Qvw8SQTc8oxdRp8KHdm4N2dlp/QIqWA6GHne7nJL4sjc3Y6i8TNT+R8MUP4JKsdqcJOcCPC1whizQ 42cjMviHx6aeQKgVsew2XBWvrBxrp4TNCmp5ZojTLiWN8jF1Ujk4gFtXaZH4oX8V4iiH1FVg0RUzf i30g1ClHyWE9X07Hki57UVL8i6teH1trLND7SbpoUtY8ew+xA/9xq9/+uYFDLkoq4RapZ1D2NqeFO YDYxJPbw==; Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdVBp-00000007ZYp-2WVu for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 13:34:27 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2ef1c12ae23so44059761fa.0 for ; Mon, 12 Aug 2024 06:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723469661; x=1724074461; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=NS2ft2YAcSDCwUAbTtmtgqphux3fbx73lEPBb8ft/BIngFL6HP5n4tiFbx7X3KVEtU Hp3oQIA9+dbVz1yv2vzPKdSHtVnqAyMUyEL6ZI7JHgLfI5JlMffmxlfFtpfS6u2UIZHQ cAz6umY4wYnxpDQz1CSQtROefJ+V5EqzfFccnD+dAibcXuKLdxEn7+9Ot9Nrs8JOicUM ZIEbqkGdEyMrPLs4cgOunmckqZZJAKk4CwFVYhNrbTZ0sR9zJ/0flR0xRLyirDp8imoQ TCB21epabRsJPknzO+5/CLNIg1w/UBD48km55xV2uyatBW4NwKUGgFRNQdAZzVTdUf2k Wcwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723469661; x=1724074461; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uOJ0Ss5PZ4IloZXXvkJRBvwO+cKYa9b2eKV5tMzUF90=; b=skmGoqc7Py2Faq6X5PELg8e2uEO5heAoMOUmDGhJALyXiLRC9GtXR5sdIWA55f4sIN ykNRCWFiTng07XzHnBxoCjIfMwLFjcq1snzHs+n1LxuYMSYrsNrW+XVl2U4UQlgQUBmr 3Lb4GJiCXZERFSQ7jmRD6HnCCX42djwWR8+3p64QnyVQSm2QYjN8Lg8Hx/ofPcZ/1Nti wH6QmTIVU9CjsLd4nMy06E5Kmxe7jTNxjxoWdC/QkEO3c9f0+Iz6o7QmSK/WMR55QG5g ge/FCk8P25c7KVv+Iq8Qz65ibnM4liIcrmFtw5E78Wn+3LdUyxK/WGhJGPKpvxtKP6sp MMnA== X-Forwarded-Encrypted: i=1; AJvYcCVwE59q6ArJyHYQFIJxxXXFVQ8RJab+PbZQWg8Sj8goAfp7OLleUyarb9daMkLQ9qLuO/6XC5QJAy3NOk0eS4kInQOh0TP1m2hqBc7drMWTMZnOhEs= X-Gm-Message-State: AOJu0YxEP/wTaj4thO9owV17GvD3X1mtWtxPr0S2XhmCj2aUIAAc7oHd 3WH+N4IqtSMZQBJW+KWfQ+V2we8GZIkdlUqlbs2DBhj4bJhgzdUpBA5aKcDCAxc= X-Google-Smtp-Source: AGHT+IHQihxBmTwZO+gpopSrog1h4Zwo6nfMe5CMTYHEB+GBFOYD57QnlF7TYHYQZ5mGOjHQLKtWjw== X-Received: by 2002:a2e:9985:0:b0:2f2:9c23:3412 with SMTP id 38308e7fff4ca-2f2b7156ee5mr2174791fa.23.1723469660887; Mon, 12 Aug 2024 06:34:20 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7737c64sm102733975e9.31.2024.08.12.06.34.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:34:20 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 12 Aug 2024 15:33:55 +0200 Subject: [PATCH 1/9] memory: atmel-ebi: use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240812-cleanup-h-of-node-put-memory-v1-1-5065a8f361d2@linaro.org> References: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> In-Reply-To: <20240812-cleanup-h-of-node-put-memory-v1-0-5065a8f361d2@linaro.org> To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lukasz Luba , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2456; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=xgfyKZmDDIbZTBcHgkC4HQRuoKCVphYVJo2Oqeoz2yg=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmug9RWiZUzjyUB45cY5GRGscQmhk2n/JWQ8eCU OV6qDjUvVSJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZroPUQAKCRDBN2bmhouD 1xyXD/4zIloc9i56JR/7avOvWMonHwPMgxrw6eW1Ql3uMGbouCHddr07MRZROHf7FHGtaDBNSzW mxhzYldkGPh7W1K5fj9UFeZ2zvkfrn+rQdUhG83d4r5ihSPYCQzBxKNTUvwKDDrn2jZ/DWAjmfh TxjAUuNnwbSkd43KLCkjRjmKHg1bCsuc/NromW6Jla20roeAfx6ousA8KIh8deLOJvUSd9IjoTP vhWCOrq414zR2AtAX4vd2IsPJM2zqwKIUt/ZXVvpV6IA6I5emax215uBPI/tq0XEaLTbW5dH/v8 JpZBGwkHxrkWhFaXEUS01fvJMEE2G+rqeMxi9GJGQSITpOae42sKZXL7jCxwsDsQ5zgfRwWGvJ5 veNYQdH4lAPRjl8MUL3h1K42k3GfVx4S1i+6PqIyC7vk7MOfuUV2WBitHAcxMyjcQMbj8XsjyvB iMMGFF8VDH2oE6eJ4aaUv+Co83vS2sYyoIH7BWNGxvSW2ajjcesSADyFhNMcoelmhpGZTckxESl 82l1O1qvrtFb0986Is0vJ6OhgHDX/Eja/dCxlk9T+SvRzZha67Ecrv1oWVyttwKxwqIrlMjdM0L b7iludiktLPGaXEtTrzpL2Xl3GZiWkzR9es+685yu7ltUGzpJVSzqu8GN4yqwd4riFxIzLgCaj2 TMtGaSenJiohE3g== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240812_143425_868088_31C6ED49 X-CRM114-Status: GOOD ( 15.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/memory/atmel-ebi.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index e8bb5f37f5cb..fcbfc2655d8d 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -6,6 +6,7 @@ * Copyright (C) 2013 Jean-Jacques Hiblot */ +#include #include #include #include @@ -517,7 +518,7 @@ static int atmel_ebi_dev_disable(struct atmel_ebi *ebi, struct device_node *np) static int atmel_ebi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *child, *np = dev->of_node, *smc_np; + struct device_node *child, *np = dev->of_node; struct atmel_ebi *ebi; int ret, reg_cells; struct clk *clk; @@ -541,30 +542,24 @@ static int atmel_ebi_probe(struct platform_device *pdev) ebi->clk = clk; - smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0); + struct device_node *smc_np __free(device_node) = of_parse_phandle(dev->of_node, + "atmel,smc", 0); ebi->smc.regmap = syscon_node_to_regmap(smc_np); - if (IS_ERR(ebi->smc.regmap)) { - ret = PTR_ERR(ebi->smc.regmap); - goto put_node; - } + if (IS_ERR(ebi->smc.regmap)) + return PTR_ERR(ebi->smc.regmap); ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np); - if (IS_ERR(ebi->smc.layout)) { - ret = PTR_ERR(ebi->smc.layout); - goto put_node; - } + if (IS_ERR(ebi->smc.layout)) + return PTR_ERR(ebi->smc.layout); ebi->smc.clk = of_clk_get(smc_np, 0); if (IS_ERR(ebi->smc.clk)) { - if (PTR_ERR(ebi->smc.clk) != -ENOENT) { - ret = PTR_ERR(ebi->smc.clk); - goto put_node; - } + if (PTR_ERR(ebi->smc.clk) != -ENOENT) + return PTR_ERR(ebi->smc.clk); ebi->smc.clk = NULL; } - of_node_put(smc_np); ret = clk_prepare_enable(ebi->smc.clk); if (ret) return ret; @@ -615,10 +610,6 @@ static int atmel_ebi_probe(struct platform_device *pdev) } return of_platform_populate(np, NULL, NULL, dev); - -put_node: - of_node_put(smc_np); - return ret; } static __maybe_unused int atmel_ebi_resume(struct device *dev)