Message ID | 20240816-cleanup-h-of-node-put-var-v1-7-1d0292802470@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 9E834C3DA4A for <linux-arm-kernel@archiver.kernel.org>; Fri, 16 Aug 2024 15:44:23 +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=IpSzvs+nYkevHrGD0uZRXPPuCA8pLPFmiuPfAoAZn4g=; b=jCMWa+9OV9YbsCbUkRuwjofXfd IExIb2zVnXzrQUGqlJJW3r1Ixibq69UwwLVtZDR+mjoibwycsqeEY96RESH5lCgL3dykGJl17C1Of QTG95gt4dm1HpFtEeigggA3ilWprUze+sAHsv4rHUMTlSTBhefRuFoJeWMSqIxwsbS0D9SyvycKSG uQtCBy+95M60syc/IzeV2Jhcov3dBjV/y5iIRFHGyuSXF9LfFmL7jk8Dq3jbd1li8PXK1ZGvU8QHG JuRVhDIMzG8bgZMRDGvgL2+plF3J72QZY3RCz5GJW0IulGVAvZ/1rvLIO6uxeFDaPLZJb+YScdozo 2SyrpZLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sez7e-0000000DRcz-0WFk; Fri, 16 Aug 2024 15:44:14 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyvu-0000000DObd-2F70 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:32:08 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-428e1915e18so14753105e9.1 for <linux-arm-kernel@lists.infradead.org>; Fri, 16 Aug 2024 08:32:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723822325; x=1724427125; 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=IpSzvs+nYkevHrGD0uZRXPPuCA8pLPFmiuPfAoAZn4g=; b=TQcU6EaD6pk2SY6oC6R7TsdSKhButPVlNMzbvLElpIqzdm1mM9tLGtNrBNjTmmdae0 qYwIgGYAEGq3VlMEyC2LsSKzAD6ut9Pr/OgPXojbFr9A+Mnw/A4912eVhmcJC6KmcRdA Y657zzxU+zxyk7ajeG2IUGjL6bYn7NgC+kOGLPv2IuwBWlKEIW4/10QEgMDjK9+O8Sy8 u11lZjFtxCaVAB6EhCmEAE3I+X6rC9N4UewFSpXSQQelJZs80cxdUycLuBQmmxu8WSUK pTAV/wwakgJ/uCpm2XIy8UgB6yBQI3bzNtOPCYVNa0E6+TuE3IWIOGcbI20I+fflpddT uFRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723822325; x=1724427125; 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=IpSzvs+nYkevHrGD0uZRXPPuCA8pLPFmiuPfAoAZn4g=; b=VEzGI4YxpHf5nZ19AGOX3j4kP1uPhMDSXymv488H/QRC2ieyxNgkp690jMZDFanmx0 7d8/zIOyG36PQlSH/oAWwCYF6Ga6kbVmjovpFehJ4S+nBPoSnweeZrzlOo+fp4tDWOLz 9rJ3vr7gTv+zNBg1fc+ZUu+2xcTT2YaQJF4zWdmvAuevrsIKrrVnPe/yyF2HwLtAWon+ GHgYPpwMZ+TOyJXxy2cZDFmNFakbcvxWDnS/RMl4eiPEpbPIf5hUlc16dmVuoRoR4nQX nGHCsOh67uMw//WAlotY9zGQBWEpsY9RqU7XuIk137Fl1O9otqpeFLtcWsa3MtM8Nw7C AB7A== X-Forwarded-Encrypted: i=1; AJvYcCUnmiiBJeK/Q0YkrZN4iwmaWQoWlkMDQcMTT+iCl9zDN9yyQ/5byXyw0d8TukbFULKS2s/Pm3bBd5uD1rsyoTX74GjV10t/472CAysl/66XLikWYS0= X-Gm-Message-State: AOJu0YyKgk5fr24VgMmeJd6pblVYHdskeF0KgoDqcE3czy1Amlzsi+a4 WH1ChNk/o8hLJMSvC3XbvCjf9+wDWF6QEmIihHL36R5b4AXP7/tK2RRdML6IMbw= X-Google-Smtp-Source: AGHT+IFIM8SM/oUAoIoij6/+F29yCUYD7CkGrKL1zCzaVxOUpWq9yef5gSYP4cevO1RzYy6a3+hjag== X-Received: by 2002:a05:600c:3143:b0:426:51ce:bb14 with SMTP id 5b1f17b1804b1-429ed7e43femr20311845e9.30.1723822324872; Fri, 16 Aug 2024 08:32:04 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-371898497f0sm3853661f8f.39.2024.08.16.08.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 08:32:04 -0700 (PDT) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Date: Fri, 16 Aug 2024 17:31:39 +0200 Subject: [PATCH 07/17] leds: bcm6328: Simplify with scoped for each OF child loop MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240816-cleanup-h-of-node-put-var-v1-7-1d0292802470@linaro.org> References: <20240816-cleanup-h-of-node-put-var-v1-0-1d0292802470@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-var-v1-0-1d0292802470@linaro.org> To: Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>, Sean Wang <sean.wang@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Riku Voipio <riku.voipio@iki.fi>, Orson Zhai <orsonzhai@gmail.com>, Baolin Wang <baolin.wang@linux.alibaba.com>, Chunyan Zhang <zhang.lyra@gmail.com>, =?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org> Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1378; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=m6Hk8gKMX1w5RtMdLACIAQ5rXDRi8vsYTQoqOdYtge4=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmv3Dfttu0MwP3EZEIzlwWVIzETU/wM+a6ZdT+U j6PqUtmWHWJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr9w3wAKCRDBN2bmhouD 147yD/9gLAyT7CaUKu376rhokAa5nBq87hnVOfCdhHEcAQUegVx3PHvtzhd1qXPs+duPUC0yuV7 Do3NvZOVUcUJRIHkBt/UXC6hUR1sJBk6WXUjJOkMj46EOuhLuwpwzLoQt/oVR4u2EO5i1FPOoTG D0Dl3i1+iWU8Fp6BAqYuZhd+e0lDEfaAkO9dSIEli4r45FXW2ljOBOky5fHTOUzPo4GoPRatKCN OrSd7SNZQ+CiOMREI6sEwJ2HVPu3xmcMAXas9HoDQKcVDdf7zHek0y+kxMU3cRX3tg0ApwR6kcL xJqDIBG2fUDG1RyLrMwaSe5nd6+NjEfzjRUQz/BuVkLV7WLafu1R23us2RtQlVzaQfzrnKou4hC 6jGSuH5a2I9OqFbVh2AwwM79Mfl8xHFEqwPrn0OaC2kKNOLrYTatVf199VGOzrcLbB218zt9LwR BRVxtpUk4zm56QgpLS6AW9O0DRGBFsSptO1UFHbsMQK170y6mJaNERN8RnkRLnN14EPw+y/acbL VQ5Ok6Ek8WU/LdX4ct0HkFJfcfaV72fBxQ2HSJpQoV+cXp2AKyaznPx9WMLwOfgT1NkS3j+Oo9M 5CTDWkCmklwcwRPvtNc5/dwJlXbY2Z/WdKS0zlQ6LOniVJx+yMLFFPzOL8+9HuAg+8jbU9MByx/ 5SnE2hJywDwR/8g== 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_083206_635836_A32EF23D X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
leds: Use scoped device node handling to simplify error paths
|
expand
|
diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c index 246f1296ab09..29f5bad61796 100644 --- a/drivers/leds/leds-bcm6328.c +++ b/drivers/leds/leds-bcm6328.c @@ -392,7 +392,6 @@ static int bcm6328_leds_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev_of_node(&pdev->dev); - struct device_node *child; void __iomem *mem; spinlock_t *lock; /* memory lock */ unsigned long val, *blink_leds, *blink_delay; @@ -435,7 +434,7 @@ static int bcm6328_leds_probe(struct platform_device *pdev) val |= BCM6328_SERIAL_LED_SHIFT_DIR; bcm6328_led_write(mem + BCM6328_REG_INIT, val); - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { int rc; u32 reg; @@ -454,10 +453,8 @@ static int bcm6328_leds_probe(struct platform_device *pdev) rc = bcm6328_led(dev, child, reg, mem, lock, blink_leds, blink_delay); - if (rc < 0) { - of_node_put(child); + if (rc < 0) return rc; - } } return 0;
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 <krzysztof.kozlowski@linaro.org> --- drivers/leds/leds-bcm6328.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)