From patchwork Tue Oct 8 09:00: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: 13826052 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 46BC1CFB421 for ; Tue, 8 Oct 2024 09:04:41 +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=hhnMribWv3j37phbroM0tsC+LvVtWuj3jNkm9Yojs/E=; b=dKMuiU8RG3/IPxsSyeAK8sQRpg CRxiZg6uIjKkuJjkjrcxHeOqELYCiyeHTxSv6aKEddsQgteYdxvuxkAlN7XZRDBw74Lpi5chhxmVp LBi1YWAT8Spwu+9m7XdYQWrQYoipT8D/K0IzSKhdgl/9BaFwlOfIzMOKC1Zg3lrejPp+V5wMJtRsR 4NulVHsM8JXqkmw+HNycliMkSvN8a3gTU1A+GIUQHhzP524nqi+rI8vI0BuwYpswiwIuMawVTxDEM KgSSO52OLIafu+b3RT2WnE/RXd+VfG4eIr1QZXrWtrRQ4sVU9hzVDM90iG4nDP7tL1IBFNbWkf4rz Em4P447Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sy68r-00000005DYJ-2fN3; Tue, 08 Oct 2024 09:04:29 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sy64r-00000005BqH-3mAh for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2024 09:00:23 +0000 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5c895d975e5so1039413a12.2 for ; Tue, 08 Oct 2024 02:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728378020; x=1728982820; 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=hhnMribWv3j37phbroM0tsC+LvVtWuj3jNkm9Yojs/E=; b=m7N8+RcKffbCnJZbaktrEse9ybyntt5DLU8E441BLcYpGySeMloU3baICVv0EqoZcC fNWk4vet2yZuYPMDeFj0Nadidk7hJUHl+0U+mOfc09mOsKj2riOZOdLOwrI79E7l4PVv f/Taan8Hnn8w9p4T9YlWg0nEEqvMreQ3y62vJkr/ePdujVjVC2fvGELlU4bAor5ffX7A /IinwHoUU7Ol4HbNYp89AMDIWsfWH8Wa/ykcvSU90IX/EZI6m6MsmBI9xC3oe//LQON7 UuPDp+0gsJHXM8Be5dU058aD7VG+Z/WbrmK33un9hhaF9kLTOSxgek7NcKiXRiEtPEG+ c6MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728378020; x=1728982820; 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=hhnMribWv3j37phbroM0tsC+LvVtWuj3jNkm9Yojs/E=; b=TQEuMzZQpxyTvoFhZUKtys0NSsmlGmUO4k9pZuilDC1Hy7zfuhHocFdhItWeqk49a/ Y0UscoLOXKbqqK5OQzVyYIbu0XYQ/y/SRFDz2xSuMsFIBQoou5/4A53qu4l10dP3Hwz5 hCOYniWQGH3Fw+6nQBuxiAKhgNt+vVjBfSMyyplMSgWB8xTMQJXktpSOy1AbwTF5Eynv KXVHVvNC52FR8qp4/AODG/ynLcoWJyx4aOVisxCzFbuKp3XS/rO8pKB8Som0eFBXDnm7 /Up0fPkJExjQhvEmiDsySGtbW7U/FXmFAVO7j91RyZj+Ds9YOSr2mY3ME3XPW9TtKaLr TzJA== X-Forwarded-Encrypted: i=1; AJvYcCU3JLFSR5iJ18WElo8q5AD5Nb5ysdgS0rx+OaGh2cxltpcRvuDcYLi2QYlcLYHEjECrpJi1WyZ4fc2VUbOOIBIf@lists.infradead.org X-Gm-Message-State: AOJu0YzTLIjuldgQSlB1AqVBn/qrVCKndAGbsnRl2xWMp7V1YhziAkQk EubrvtgXPh4nPI0wHTBQQaTIJ3coo0fnfXS2fGcDgtugZgnpTPp9RkQ2Cgvsb00= X-Google-Smtp-Source: AGHT+IGoeQaPcBnN254hi6TPgYzKLQXhpimbmfSA3A3nGgS1sxK2mD1XE9GMOjplQH3EBO+qMZSWDw== X-Received: by 2002:a17:906:fe06:b0:a8a:93ce:d252 with SMTP id a640c23a62f3a-a991bd1d16bmr678141566b.6.1728378019795; Tue, 08 Oct 2024 02:00:19 -0700 (PDT) Received: from [127.0.1.1] ([178.197.211.167]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a994e6e571asm294701166b.85.2024.10.08.02.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 02:00:19 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 08 Oct 2024 11:00:01 +0200 Subject: [PATCH v3 1/6] thermal: of: Simplify thermal_of_should_bind with scoped for each OF child MIME-Version: 1.0 Message-Id: <20241008-b4-cleanup-h-of-node-put-thermal-v3-1-825122398f71@linaro.org> References: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> In-Reply-To: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , Thara Gopinath , Thierry Reding , Jonathan Hunter , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1359; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=O8Lj1eetz/yrhGeWhSCrulP80O8gYR9QmbQcZv63r+0=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBnBPSbZ8YaUgCU2m21zzswmGFg8FNILw7sZbEcZ 5bVpN1Bs56JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZwT0mwAKCRDBN2bmhouD 18a2D/9sDXBUfU0ZcIObHORU6mvM2qGTl/54it8fLk4jaTUn/ItOOFLVrWgKHLT3tWk9P9l8tMf iXljprk+xbme7PDZFPYES31h3bjF9v+81xcuJM8YyC/qBMm7RMn0PtOpv1UQO0N4cefWFujYLay 5YWw45RaXK6W3jK202Tm400nWTQ3+bzazZdpAbxwNDlA0SwsyWWodwgNM5aB2pMJUo4imXyVmwT WhcQroeTRZfvEusL+mjukqFZSKm1vAu1cZcMNP1pBr1LhNsjwUxyOEJOs2hOM3Is7CY8R/36kh2 kKYust5Hzt6ypzZJa+M1x5N3jnxV2ud9nNtJ/jwJnqc5fCkUw2y/H5euR5KdBPlNsWZNv39tNzC uxJ8EGkspuin5wDdbylRhfztP1MfWy71iijuDHuwH+X08spYTUxr/uR6pIZ6vMdGAtp+G+rb0db JhkedK4n35XkvRGAfSZHrvx9TT7jX5sqW6Wv5KzHREGd05oTnr1nMUQWPNia1rgYMTd3Qd/G9eB tHHttQ7ZuL+LexkhaBdkloD7z/Kftr9ZHSWt3FfthbdU/Ksf3+0hAZP/ekq8TupL5OC/s7sqvtu SN3fU2I59MuaWKYliQyDBHq9xN6dyV6syU1lg+BhtggWg++gY69HzrO2ORqbVkBtGEyQNopiu90 RTHcc7aGAX3dZ9Q== 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-20241008_020021_989804_3710EF47 X-CRM114-Status: GOOD ( 13.03 ) 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 --- Changes in v3: 1. New patch --- drivers/thermal/thermal_of.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index a4caf7899f8e4a5f3422e4c02c66502b5050fd6d..f0ffc0e335ba9406f4fd858d6c561f9d23f4b842 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -301,7 +301,7 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev, struct cooling_spec *c) { - struct device_node *tz_np, *cm_np, *child; + struct device_node *tz_np, *cm_np; bool result = false; tz_np = thermal_of_zone_get_by_name(tz); @@ -315,7 +315,7 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz, goto out; /* Look up the trip and the cdev in the cooling maps. */ - for_each_child_of_node(cm_np, child) { + for_each_child_of_node_scoped(cm_np, child) { struct device_node *tr_np; int count, i; @@ -334,7 +334,6 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz, break; } - of_node_put(child); break; } From patchwork Tue Oct 8 09:00: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: 13826072 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 8C6E8CFB421 for ; Tue, 8 Oct 2024 09:06: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=adCWIIzBDnCRS+ya+uwdE4DOJNV+C/EsMYDSwCJFffY=; b=B6FPkR1HwIWW4Rib8/6ngf6XHq xVo00VVOWpfjJ317rp+t5WoD7w7474td1/4vCYL1EMdePC4ptpMK2OQGhMUrJPXuhgiR+ZX6lFotB utV+3DpU6vgEmeGGlLGjB5LcRhDcQsubKnVz8/Av1BV0GZS6hfJi6FAfYLdr6QKiCFvOnuMrn+/S3 uxqj+P9rUvDuejhX22Sr9TeUix/FRDqfhiL1KhUp0BtnEHvmhrddV0rI9btNINmbtKZsS3dhfUMlX ecWujkHojkMWSuwajm5BM/RGldhvy1vDpo4XeXCDz/6KN5n85h9OzMSsvr9VXIqZpYUVv0IK/eywm w0asXbfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sy6A9-00000005E0n-3EWm; Tue, 08 Oct 2024 09:05:49 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sy64t-00000005Bql-1XbP for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2024 09:00:24 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5c87b2f1913so1017783a12.1 for ; Tue, 08 Oct 2024 02:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728378021; x=1728982821; 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=adCWIIzBDnCRS+ya+uwdE4DOJNV+C/EsMYDSwCJFffY=; b=hjZdxQqlkH0HogcLv4HAV+qowgXIkkAhixH0yjxKKq4yaORyDD0r1OVMzoSlcw32q3 8+v5EXPNeUdJrQOMePLMPvhPk/Oqn+Vcrb9P3bOT5pIAGmyL7tO2NTH8DEXyqhmU3yOp TzSsQ4/ZXbbj+dLppMQE36RO8axzVyslvFMxfraRhlA16pASnrOz9ELBXFpK5EYVKbsJ LdiNyr5JQiPtkSraFuV7oTFss+I3HOztOZHUhiAekIaVK6gCcth/dnjOUgY6kVIsMmQ8 6BPT4Ipvt6J1E/7NrZKV6pDucQ2NV/qoUJqZiipHTsrZRnDuqWP0hpnS+UKFDkUPQQgN vBkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728378021; x=1728982821; 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=adCWIIzBDnCRS+ya+uwdE4DOJNV+C/EsMYDSwCJFffY=; b=McBRTbrEHjWRWmcVWuAtnYy5nhQvXi/3k+fCn1rLZYaZw9TzG/nTIIl4WKjYXElZg7 wTiK8EDa8G2kVMKHL83fZtFe5MuIw6xye6CpCwwptVIEpW80UBUO7ekf9F1TnS+lS/EN Bjn4Uejf16o5TGrQZA+krETZn3EfF9v2qhAwmvphyHXRqi/KKsKgassXDlZ+kjNkqIZT 0Akpx+Ak/Z0xgs03chq613T0X9lL7Ar11xN0GRd3K+Fw7P5keKeKKey2QJcdwM+XghwQ q3z5gkhKNBbxQp7+hLUYZDOvoboUoWFeRfaGFK2ooveJ2msbhjdMJwDt36T9plAGCvuK KT6g== X-Forwarded-Encrypted: i=1; AJvYcCUZDnVgTNp34U7NTr6O2ItUWajxRgTzA1HxwlO2U2/bxXFEYfMrWSgqhZjpfh+2uuPZWUZDOsWe+O+I6no8J5pg@lists.infradead.org X-Gm-Message-State: AOJu0YzYrTmkkYTQ2efdo8VPq5yGG3gDKG9jeMpR1q/hm48bA+RQKd5J a8e7mfDuvlS7jOT5VxXhfYbI7p7BOYhI69SeMV1xQVUB7/VrPHx77kIY4WxYUT8= X-Google-Smtp-Source: AGHT+IFyV5YlbliLB9Sn5wjUH6COxSzrncdb5qLhEV2J0ae0yBBiwgw0xI+8Arc8blW6t7WRxnafRg== X-Received: by 2002:a17:907:9443:b0:a99:482c:b2cf with SMTP id a640c23a62f3a-a99482cbc1emr374351766b.6.1728378021503; Tue, 08 Oct 2024 02:00:21 -0700 (PDT) Received: from [127.0.1.1] ([178.197.211.167]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a994e6e571asm294701166b.85.2024.10.08.02.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 02:00:21 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 08 Oct 2024 11:00:02 +0200 Subject: [PATCH v3 2/6] thermal: of: Use scoped device node handling to simplify thermal_of_trips_init() MIME-Version: 1.0 Message-Id: <20241008-b4-cleanup-h-of-node-put-thermal-v3-2-825122398f71@linaro.org> References: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> In-Reply-To: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , Thara Gopinath , Thierry Reding , Jonathan Hunter , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Chen-Yu Tsai , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1919; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=r5aPI6Cjn0TQVJCWexA1Rya/HBg2dq+HlU8Qr2gItOQ=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBnBPSceSnEJp2lwlWByHAa/bugTQ/6DRWAT9fJb uGRxYnCYsqJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZwT0nAAKCRDBN2bmhouD 17qJD/oDEDMG+qPpZYnaeRaztl0WT4abQ4WaCF2e5zgAu1S4llK2iQRYU0KB6Ddesl0KwXgMASd lmhBMg7VnYj8ZVR1cKExnTlws7HzVniO1HtKucpHlVo/1w9q/4nF5qusN2cj5/1NRIWgPA+U4CM GixsfXrDqjN7X2TaZ1eD9alLmIWjLXzyCiC2Hv4/E87ml31QZI8BM61nDrC23BRD9QnYUqkJMcU +j0H+99j9zNVohXBZrjDt/Nv6e6R1/tw/vgZgsomtaoO1Q6K2XYkl03q0ceZQS4jjqEq0Gmi0xV v0u2ZQlDTkKdB0oCeTuBwOqRsI62HW2J8tSnS6be7Otj2SDBNKEMT+D5O/6Dn3x1U2U81G9kZ6T 6EQQ8wQLExZprKqb89dkvyNw1gbBo5hKIaM+2PSXbxat3Jv+WpGq5mxrC2LfhzmFJmBqqjguyB/ k5+i9d46I76NJz63ak0t2QV8I+zn+aC10/+1CPDRO3V1laC+Zj3uoelmnA3gvgPYv+oFFOR1VyN q27M4IGIzUPAAl2t3IKzEqO9qFpl/Ba7gIHqUVDEWXzxbhd2ylR+H1sPz57KliloCQZmRJR+Q0W 1XqAaqaIAiFBXYKdSz/CZziyTsQTwHfi6k22ruGEkOWSbFJKBuyWMiQkDaWkCSH+YgwtHlvT2gw YynUKo3nC3wtIng== 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-20241008_020023_488273_C962B11E X-CRM114-Status: GOOD ( 13.83 ) 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: Chen-Yu Tsai Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- Changes in v2: 1. Drop left-over of_node_put in regular exit path (Chen-Yu) --- drivers/thermal/thermal_of.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index f0ffc0e335ba9406f4fd858d6c561f9d23f4b842..d7d6f62caa13d545e5f7fae4c8ac1e737bf4c4b1 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -96,10 +96,9 @@ static int thermal_of_populate_trip(struct device_node *np, static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *ntrips) { struct thermal_trip *tt; - struct device_node *trips; int ret, count; - trips = of_get_child_by_name(np, "trips"); + struct device_node *trips __free(device_node) = of_get_child_by_name(np, "trips"); if (!trips) { pr_err("Failed to find 'trips' node\n"); return ERR_PTR(-EINVAL); @@ -108,15 +107,12 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n count = of_get_child_count(trips); if (!count) { pr_err("No trip point defined\n"); - ret = -EINVAL; - goto out_of_node_put; + return ERR_PTR(-EINVAL); } tt = kzalloc(sizeof(*tt) * count, GFP_KERNEL); - if (!tt) { - ret = -ENOMEM; - goto out_of_node_put; - } + if (!tt) + return ERR_PTR(-ENOMEM); *ntrips = count; @@ -127,15 +123,11 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n goto out_kfree; } - of_node_put(trips); - return tt; out_kfree: kfree(tt); *ntrips = 0; -out_of_node_put: - of_node_put(trips); return ERR_PTR(ret); } From patchwork Tue Oct 8 09:00: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: 13826073 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 1B55CCFA754 for ; Tue, 8 Oct 2024 09:07: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=6VqC8VxguTcsDUEEbczg9yl17o4tpL25LM2OL53pKrc=; b=GUDjGLM5PkoovlFVJ49Z2zeTja f0nojh3v/JhzGRxX0gFYFR+7X6CbkPR0H1IYgaQStazKL8L01Ra/8dcgVJtoLYGi0uekeqWdf+61f AOtZ9qrAFbR4dvK9s8pZ7CE+Ni/hVnWbIez+Z4nyiAbqHDsdE0mWEbXhhgLfaNNToHzKyvUYDjzxO zafI8SKqmppS2AXfEi8m482IltP38UB7VTESBaioqhgvhzx9W3lehW0atbdsRvgXRjBH+5KsKWDMA Wvb3w+9URR5DXQeee7WkGko2aGdaiB6/Hed5a+bQbEDoL/UWM+WJZdO2HU0kGcenDYNAwaIzGaVFV xY6CbIUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sy6BQ-00000005EUa-3aeg; Tue, 08 Oct 2024 09:07:08 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sy64u-00000005BrY-2wM9 for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2024 09:00:26 +0000 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5c8856e3e99so917707a12.3 for ; Tue, 08 Oct 2024 02:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728378023; x=1728982823; 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=6VqC8VxguTcsDUEEbczg9yl17o4tpL25LM2OL53pKrc=; b=HDaLLEHXLtSOC4YL6piFduLvlXtQ1sfBSIolJbOYfnUgu1PIkBVhoMLVaRhd5Ej7QN aQwOg8m1lpJF4uCmLKh7L8cw1hIbaRx0tFGyP5LCVvB4+3bswhedr31Rd0C4PUUQyWlI 5zNWQOtUByMgmcs1MV8884oBZ3KOK7jtKGgM2kzi5K17C0WwiKeWjEMFCyCJeeOyi0kG UplQkPFK/32VDDigaie85jBd/cTm99uOpm/wa1dMHhKNsJeSbm3Xv92giC8nwB7enIZA ggL+d+Zo7LDw3wgQCpQpXAz1HYOIRySm+qW7DaTnZ7RuzDrP+E/2bc7m1OQNj2ZivMXb ZEdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728378023; x=1728982823; 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=6VqC8VxguTcsDUEEbczg9yl17o4tpL25LM2OL53pKrc=; b=ZyH6m657PRzCgagkQq/67msg985A5wRXp8zlHO/5Y5k2gzR18t2Ziq2grPP9frGMHC El3hx7HKEvzxrEW/VV+s7qMLuYVAWcF7XKiZQTjiwhpZNjgpMeU4N9iphhxcVZKz2EJs N/+SFQGrd2kfj7iUUmbw975cXNbMWG5USR/EhYLTCdEEpI9P3R02nk5LdUJVGyCgFJH7 vRANCutWlnBeUwNYdaVUCjxlnFI0uQIDmZ3aI5J8GzBExh8cALyWrWslxjLSiUq728Ny JiYaKNjv/+ZyI5DS3/peY+ky9sFc7Rgyl+d1mkw/ps0mfiBJgeQpJF7tMmM06cD4bCT8 62Ig== X-Forwarded-Encrypted: i=1; AJvYcCWMJpokzeGxtYv0tOXV+wXXwgM5AaUbRf3OfSfrKitQClpwWTcO+s3Y/tP1c/TlMFrU07U/w6D27IFwB/exSFKh@lists.infradead.org X-Gm-Message-State: AOJu0YzQOzoiIirS6Vy1RhsOJdokGrWllPsfdl2MaT+QZhrFLOlrtKIm Opq5G0wyMq7cF/ocgJhJVVGlSLpqqRsZSL5qdwUfcLmpZRP0HS4p0zoNJAHppbDyOnwbtN/XkjF K X-Google-Smtp-Source: AGHT+IFEyUOTrrK9/MFjPogQ0jScCR6ikh+1YFZdLnlwxjJjHIEA4i0X2pX53X+tA6dUtRJR33C3mQ== X-Received: by 2002:a17:907:7f8e:b0:a99:63d8:a1a8 with SMTP id a640c23a62f3a-a9963d8a3c9mr114298866b.1.1728378023275; Tue, 08 Oct 2024 02:00:23 -0700 (PDT) Received: from [127.0.1.1] ([178.197.211.167]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a994e6e571asm294701166b.85.2024.10.08.02.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 02:00:22 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 08 Oct 2024 11:00:03 +0200 Subject: [PATCH v3 3/6] thermal: of: Use scoped device node handling to simplify of_thermal_zone_find() MIME-Version: 1.0 Message-Id: <20241008-b4-cleanup-h-of-node-put-thermal-v3-3-825122398f71@linaro.org> References: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> In-Reply-To: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , Thara Gopinath , Thierry Reding , Jonathan Hunter , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Chen-Yu Tsai , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2232; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=f8R4vPEQrLlg+uQU0hqpfy7huKkBhYLvXSmkKXC3XkA=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBnBPSc31927xZQcLU9qXE2lgs2BbLCHiXUAd+pK iFxi47CEw6JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZwT0nAAKCRDBN2bmhouD 15oeEACMPR9GWv/Lx6eziZByXPhR16yhAuUFH+uuwrhfEAQ4OoGlvn4Hs2p2xNeK0o23LSFTF84 5/585BxDyRxRxD5QUwVkAG4hjhOtM6d36WED3JkfWf2JfMOuDD7RyUlhBJoaQpoKTdqlFxX83Ho WfacrlEkzaUrb/lDCXRkwqvT/W6txqPHYu7/58XL6uJw1B/HFLNqVHgMNik3twv5hYXuxQDYYJf isAjLv4jmumNsZmNKMGCJzd2m7iw38DG6IbBb9YpRLHrFpE2UT/wSR/5FUE3vfY/gbxZq3IV+/K uJlL5QNoxac2OIN9gAaq4VPhFEfSDJ093n2ndKb8077Nin5Xlx39Hu+/OHjcuYhQEKWrR7slXDv YSYn+LMPCogPt+pSAwNuVcl5TDGqdaP5jzuEzM5CdPWkO1JUn3BpdmRMkF17skarY4Ah1+dkio4 vevoWc3Nxi1eSXIk4pyN1kgARorqU2h2aNa9b+JDg7JZmB2w/QD6AFO0+zQZRuIUheJinukanpq UwOx7kKPX4tn6V8IU0E09c5RBpmgLh3h8u/TuSVvVauunSDe4uykBA0zgeoilt1/oWEPkY1e5ym o5+1PlHncSFlWKZg8nT5fdBt8AOCn0Yu/0hwRQ/w62u1UbZBA+VYMI6sL3CepEpBJApQcx7Cg+m +cvCh7nM/j/YjSw== 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-20241008_020024_787737_D8454807 X-CRM114-Status: GOOD ( 13.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 Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Reviewed-by: Chen-Yu Tsai Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/thermal/thermal_of.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index d7d6f62caa13d545e5f7fae4c8ac1e737bf4c4b1..a2e20986668b7aa465f3f2ab861f70101d2111c8 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -134,10 +134,9 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n static struct device_node *of_thermal_zone_find(struct device_node *sensor, int id) { - struct device_node *np, *tz; struct of_phandle_args sensor_specs; - np = of_find_node_by_name(NULL, "thermal-zones"); + struct device_node *np __free(device_node) = of_find_node_by_name(NULL, "thermal-zones"); if (!np) { pr_debug("No thermal zones description\n"); return ERR_PTR(-ENODEV); @@ -155,8 +154,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int "#thermal-sensor-cells"); if (count <= 0) { pr_err("%pOFn: missing thermal sensor\n", child); - tz = ERR_PTR(-EINVAL); - goto out; + return ERR_PTR(-EINVAL); } for (i = 0; i < count; i++) { @@ -168,22 +166,18 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int i, &sensor_specs); if (ret < 0) { pr_err("%pOFn: Failed to read thermal-sensors cells: %d\n", child, ret); - tz = ERR_PTR(ret); - goto out; + return ERR_PTR(ret); } if ((sensor == sensor_specs.np) && id == (sensor_specs.args_count ? sensor_specs.args[0] : 0)) { pr_debug("sensor %pOFn id=%d belongs to %pOFn\n", sensor, id, child); - tz = no_free_ptr(child); - goto out; + return no_free_ptr(child); } } } - tz = ERR_PTR(-ENODEV); -out: - of_node_put(np); - return tz; + + return ERR_PTR(-ENODEV); } static int thermal_of_monitor_init(struct device_node *np, int *delay, int *pdelay) From patchwork Tue Oct 8 09:00:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13826074 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 AD832CFA754 for ; Tue, 8 Oct 2024 09:08:41 +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=7hI3WMX3UyIZgodODIkEfxJvby1HaOS571OBh/jtnnQ=; b=37a6iORvL8A7MdBxzmDVTZuxKC ZPiyVoqJdP4DJkDUcvFM3qpDinQIIyzZpQoZbPTZ5YEhkdpnWSpujaI2A6r/w5UonZDHI7G9skuXs QBXGLfB70VugUZ4YOCX0kKhPlZBFQwZ+wFHjUF+5wBzIQcwU+jzT1xKESG5KQWyfw2VPmvuxQR7xT VDrL6xrldhWCPHiLihRWp7QpLrmHq4QDoCRtPAc09vl3GkWy8P6oAhKy9HhqwVWbAy0Iiyf1hXqy8 k7HiHGYs0IQcSmSIwy60Akjnh3hMW8xO+S2pJ6h7lC1kdZ0r+oCh6SgpvKtF2jkxJ8x/WwRpJkECW txfpmTMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sy6Ch-00000005En2-1azo; Tue, 08 Oct 2024 09:08:27 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sy64x-00000005BsK-0vl1 for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2024 09:00:28 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a994dbc40a0so22300666b.3 for ; Tue, 08 Oct 2024 02:00:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728378025; x=1728982825; 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=7hI3WMX3UyIZgodODIkEfxJvby1HaOS571OBh/jtnnQ=; b=l0YKtP5kWuj9o9d+zm07ENfqWOiGF74SbhUD+xI8nWNHDd6gLhxCkU2+ENdJ2XZAxa eI4xLPwmFzmo+UnC4qoRedw6tDddhIIBnQGkWr4Dc+HeN5DTCX6uHoUSPrjw21jk2Ep9 YngL3v/w/D+/h/xJ7a4JzCnzVGZl9iYHXZ1RGf7GdolD7hFWl3grxha8yYhNpUqYBl3H q42VXMaetye3UPSsEBvtfSMRb0Bs5fwKxtrQa4DBbPI5m4A1j0d5gVKpTNN801RD/6uS MJDmBfyjG1YzdLEfl6lVGmEhTecrBlwt9OYsw+2bhFTeztdSw1m21PAS/4TtVMHlftev pqwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728378025; x=1728982825; 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=7hI3WMX3UyIZgodODIkEfxJvby1HaOS571OBh/jtnnQ=; b=NaWdiwlqoD07zBz7WtQIdJH7QMsdNhY44FCgR59sOdkgGJEGrqeG6AIGXOBE1WXPFK 0n2B4AKzidi57NRGkvnsn1+0EAohCW3640+8/uwCwSy+J9w5hNjieoPkiRq5b2ElUI3t DsEZf7DU5pJOo8bu+C1/f4+Gz9vOhIYyjJgHoDNjp94layIJ44jPOGAGfTQ4Yhu+wvz9 gdLf0HxkLjUOmUUyUHf/IoIq50SPV3Lmm8N08FT2EIexKe0BTRl/WqXPqqnxN2llK5uw mNBQe7Ei/UMiVvUCl33z3neqxf9VRgY7Pv0iQZJlImJvReI5WmdGqGASVKns/kseYeK2 RF7g== X-Forwarded-Encrypted: i=1; AJvYcCW+zJscZ8oMTecBJP8aWRmkHSjyxNxXQ1oqlITgwfE8jCYpRxZmgtf8r8QYnkbpljKzFSe3bv6BKS8YkRZ2kr0u@lists.infradead.org X-Gm-Message-State: AOJu0YwPDKn1MLxhSrkethwnCUzEZd6TO1k9oa9ljSk+EcP4g9HKY09G CBS6T1D2Tw8ui7fMRTj2ELWy8ViztOEE6/gQVINZ4NNE8KfHxMGjoIgdLEn8W3g= X-Google-Smtp-Source: AGHT+IGn3CxuMTqoQCh13mz4jC9JwZZSlRHEULhxnYn2dzYEgwR+mm0SUFPiPolkk77R3YOE5iHsbg== X-Received: by 2002:a17:907:980c:b0:a99:55e7:9736 with SMTP id a640c23a62f3a-a9955e79ec7mr244229366b.0.1728378025394; Tue, 08 Oct 2024 02:00:25 -0700 (PDT) Received: from [127.0.1.1] ([178.197.211.167]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a994e6e571asm294701166b.85.2024.10.08.02.00.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 02:00:24 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 08 Oct 2024 11:00:04 +0200 Subject: [PATCH v3 4/6] thermal: qcom-spmi-adc-tm5: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20241008-b4-cleanup-h-of-node-put-thermal-v3-4-825122398f71@linaro.org> References: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> In-Reply-To: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , Thara Gopinath , Thierry Reding , Jonathan Hunter , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Chen-Yu Tsai , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1389; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=fMDVmrSNIlAN6mKgDdvZqzHHbI0RRw3DAu9CnirmtAM=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBnBPSd09eIsYVkCYVYCFtZlxLflDGibJpZer6/c cwqxX/AN7CJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZwT0nQAKCRDBN2bmhouD 1/IWD/9fe/DMRWMYbu4UcWX2DGRdX/wQYi2rD7n8B+VkDmq0wfAQZ0HLkkbappU3ISFcb+qEqEo ukgaKzu1lpDWZXDdGsUfbinrxufa5/xftAt2khQWgmWq5QwdtwBIF5jm4dGHvc+yQEBaoJ3ZGeq aMXoaSTCMCAogUZc0ic+SdX/plf+qg7gs4nimuwtpndONT+hq3qYHvk3hC5x0nhAMJ0gSmKS840 6g6ySO1Ji/wqZp81AifDouypuz7xj3vm2mKT+SWOOcYmnlx8gwHCXXvCgaIs1ulUwxMXkB11p7Y R6k4dVvZqTb8HSOB0Ez5JVkEJZ1w2HxF+rt/doKnG0Rw9faIlqf2eJ7B6DoujNofmCvqSrK5cax vCo+kx1rVHqwH0LZZdbgmYNZ7GrLR1yTM0gBfm0b0QQCHSgIw5EPAKT4ntW41iySAt9VWiWbP2U leE0F/Ffqbjg33IoY9O636bHq081Srro9eR1vdQmzDJK97cx2tBueTKltT6mLhZhz3PtgQpZSib x96MJXhDmBFG6meZHxPTkJXkFoc5punDftyolCJsk7u9nyxVx9BjzZ0mM5SfsX84ulV/e9OYOyg GE4vXrRlnSLyDllpDe7PngXzY8YE8XgxqOeDEEilgxx30OoFYTxCjzQYBJ/2YzVE4ieyMkl991V AD3UH91yTwkEzmQ== 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-20241008_020027_303385_FEBFB556 X-CRM114-Status: GOOD ( 13.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_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Reviewed-by: Chen-Yu Tsai Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index 5e94a45eba3eef65e436a01b3aa58aabf5f706c2..d7f2e6ca92c2c9fb532ca5d4bcc22b6c2cddbdb0 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -938,7 +938,6 @@ static const struct adc_tm5_data adc_tm5_gen2_data_pmic = { static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node *node) { struct adc_tm5_channel *channels; - struct device_node *child; u32 value; int ret; struct device *dev = adc_tm->dev; @@ -982,12 +981,10 @@ static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node * adc_tm->avg_samples = VADC_DEF_AVG_SAMPLES; } - for_each_available_child_of_node(node, child) { + for_each_available_child_of_node_scoped(node, child) { ret = adc_tm5_get_dt_channel_data(adc_tm, channels, child); - if (ret) { - of_node_put(child); + if (ret) return ret; - } channels++; } From patchwork Tue Oct 8 09:00:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13826075 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 D2ACACFA754 for ; Tue, 8 Oct 2024 09:09:57 +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=4oADJGjtlfntgi0z62nuqr2PW+j4MIg/odMBZra4oxk=; b=BqhKcSxsL75UtBywuVuMynJzFz 98Y1JDX5+2N70DMb3pIjyKbmvzZFY/AVrtWVGyd0R8N4lDr9fbgKgyHbR9lJaulp+hjJEHqZvqQVv 9X+s4fUu3tEoutB7OY+HQnwE2i7HAt5tlTo8wMo+r3EV5RCVYTw1FYOl7Drt+qeRb8zhX5NMYmCzD +sxW8E5+BVMG3IxuRhDERoXUrFDpdVp623TmqK4v7TI7A2F6JrKG+v04q5cvOTNCQt92KAJgMEKyb gsANMDCnyH3+QQY1nBqUnmY2yArQ6POLToLFwZSsfrCLBRGFUHF+wkDzOmTyRqt0OPXgz9l87OSMQ bfVjM9Sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sy6Dy-00000005F56-11Y5; Tue, 08 Oct 2024 09:09:46 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sy64y-00000005Bt2-3oii for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2024 09:00:30 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5c876b6c061so896050a12.3 for ; Tue, 08 Oct 2024 02:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728378027; x=1728982827; 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=4oADJGjtlfntgi0z62nuqr2PW+j4MIg/odMBZra4oxk=; b=H0YYpuBa9PsDZCu00daSfnQaHhbIopckSJwHIwut3phjeMoA3FHVj8hoLeY48IIu4z lkVy9/WFg+XIq56LkjxG/DTcLeB06Oa2dbjmzkIck7qTLYsQfjgHcQGl9QVjpqlyYGxc 1wbUV/nmKLHq3djM0nSE0vgx06ZOCFVeft303raNnWGdAufY1e2lpbXAGukuiL9rqknL rOARRq4e2//BKkWt0Y3uOCdofvqVtE5WOeANc9E0N5JykHHbpotweT4mcXg4IJMJJFZ6 AHTqenj/iJryGPPkMM+gt7LNuKO+/xyUnOlZISzC4UZM1O62Q1Fx/l9LLLLdl3xLGls4 YACQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728378027; x=1728982827; 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=4oADJGjtlfntgi0z62nuqr2PW+j4MIg/odMBZra4oxk=; b=FsXy41FM+l/vkM6N3hkUgfZUFm2U3UpQxo6CjZYh4CxjUNfL/WPtGMZ5ksB9Hfjkru Td0YIABQZVthygZ8RgqcW/ow3xQSmnr/EnkxAGMzawYjvlX2Ibj52W9qtVf4qxb/GFJ8 i8Xt9YwQ5/Suq8Yg7FWOprreiGPMR+mFbLk/swsJgqcWrmrNf6x9H+VxZe3xrMrsCgzd Z3CpcjoapYl/tpwPFRFRILEv6flJOdj14p2Lo3LcD1qLJKtLK22GaSNOrh58OOxvwUHh H1cAolSzf25ipemFzs7o3tLV8usquvAviZZnhVh/m16/r/WlcpBAFz0np1Yogr+Hsb1n SD8Q== X-Forwarded-Encrypted: i=1; AJvYcCVsqAJ+ybuS8XniDCaXqrYorYWUktdKWlEw3qk2BbklkBKqdNYKFzDw2Y96xVtdZxsca3CSWDUwzZkv7sfUs611@lists.infradead.org X-Gm-Message-State: AOJu0YzwYF3QkJmbm+56rOnmOs1JTK87EQbc6baSOd4NVUEAhEQDHQLM PzJJb5Xwv84N1HZDXrJy534TyZr4NEStlESJKoIwaa15Ml/RPywPhNqfs80u1/c= X-Google-Smtp-Source: AGHT+IE4rAwFz4YToK9oIOrST4cNJVzihTb7ARFndMACSf9P5n3oVTiyvIASIpzgE+N85pWnytiblQ== X-Received: by 2002:a17:907:7d93:b0:a99:4c5e:1b35 with SMTP id a640c23a62f3a-a994c5e1e7fmr375623166b.5.1728378027050; Tue, 08 Oct 2024 02:00:27 -0700 (PDT) Received: from [127.0.1.1] ([178.197.211.167]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a994e6e571asm294701166b.85.2024.10.08.02.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 02:00:26 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 08 Oct 2024 11:00:05 +0200 Subject: [PATCH v3 5/6] thermal: tegra: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20241008-b4-cleanup-h-of-node-put-thermal-v3-5-825122398f71@linaro.org> References: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> In-Reply-To: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , Thara Gopinath , Thierry Reding , Jonathan Hunter , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Chen-Yu Tsai , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1416; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=NAkU7Fk6Fp6cGUBKd+rBMuQ31s4lw/iDzBqC00OUzpk=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBnBPSeZwtVtveYq+plqJz96zA+Pl5Z10FmeGEoL z8/CK2Td3iJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZwT0ngAKCRDBN2bmhouD 19neEACPde0mZ3s9xDglnBk+mwX4fYnnR8YXiTLCvHtDoaID2MYCaS1/7liq1DK0w5ky95SVDfC lhNAjEEg7PICNBWpbcaGN3HmTqAJnBzqG48JxxPY0aL+0O+v0gYouUOg2Fen2+Bkx6Ww9dqoc/o b/ssg3PXLBrlIKvnr9TQG/a7R6ScWMInk9hROjjqa0wa8Qgf5Nod5OjDOj8eSlYZGYArRuQuJIK GxjDjXBjyuocDsS3gIwACdpad6Xq73fRnCHa+daqvzPkXTdoDvxne0pji/O3SWOc1XaPef4jZor VnhZx60VBfpe9mUu/SKskmb6eJTHMliR3VOd+z2rd35fEj9Ld+ZoMgqvgtYfMKppDfAIsY/nOEM j4Ty7gK+pfvlzClxwec9I1SfuS7u/iw/7b4bUof+NiTQfWVpq7JIhj0JID599K1sONd3KYR+n7l YV8obDRv68tTDgCgJHUPHLvfEb/CvDlbFrV+z8SBKni5bAVd559zQCMMkxIZZMmprhEwz5FhmxS q+dmqM084LYIbThZnZFUZNttvJQ24ILNvNBs5iesW3E2cs+WAMBNbITWDWQX7T8Upr14tH5bTHn XOW2R3O5u9gZoaGdC9yXwGMPr88H0hXRJKbpoPpxsjoRD5GG+jyzcePviq2TNoxErvhTmh8Vkmd VnXeFrorXAr9TYg== 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-20241008_020029_118251_2F65D869 X-CRM114-Status: GOOD ( 12.76 ) 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: Chen-Yu Tsai Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/thermal/tegra/soctherm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index a023c948afbddd6d9fc1a00b2fe310c71147bda9..ff4eedb553fb6e78c94b714dd179193c244b6589 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1651,7 +1651,7 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct tegra_soctherm *ts = dev_get_drvdata(dev); - struct device_node *np_stc, *np_stcc; + struct device_node *np_stc; const char *name; int i; @@ -1668,7 +1668,7 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev) return; } - for_each_child_of_node(np_stc, np_stcc) { + for_each_child_of_node_scoped(np_stc, np_stcc) { struct soctherm_throt_cfg *stc; struct thermal_cooling_device *tcd; int err; @@ -1683,7 +1683,6 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev) if (stc->init) { dev_err(dev, "throttle-cfg: %s: redefined!\n", name); - of_node_put(np_stcc); break; } From patchwork Tue Oct 8 09:00:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13826090 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 E0A16CFA754 for ; Tue, 8 Oct 2024 09:11: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=WqvSXxv/sXZh4YDTgQXsf5TmgeATsSUVXTwwhzFav38=; b=F0/ImMC3jt2idReB80gUWUVgGl 9IBEM/aKajOM1m9AbzzYYl4PYGRHTX7fuxi6E48O7Wbkgl4uYcDlhW/kkNTn/OTRogkYYLbdrd035 VFMEZnB34hmTm4pIz/mCNgUvZoAk3kMij6lZTBPEuI31vd/SAOxb0MQzR23sBWAct4jgIqantZW6i 2wT6eUGnsnYiPKWvpiQDwm8H2YDByNFmPSbtCe9KCjukfAkRsdjpVlKmLCWgs0pXKvLWiTP8qqpeM 9jqHE1oQPh6RD64tLLJ2C4Vwo40q2RoA/0Eb+XYUeuc+IW3FBf7ixc5IobzK1LNMO5LATnkTxOKPK dwt0roSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sy6FE-00000005FLi-48CN; Tue, 08 Oct 2024 09:11:04 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sy650-00000005Bu9-2E7n for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2024 09:00:32 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a9953d3b2cdso22270866b.3 for ; Tue, 08 Oct 2024 02:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728378029; x=1728982829; 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=WqvSXxv/sXZh4YDTgQXsf5TmgeATsSUVXTwwhzFav38=; b=sOM02lwfgai0gbAoK5nCB024HvNvTlNg7X2BkSR5b1Uwg7Sw6/+qOqFQiInhZUvdwr uQ9F3EMSYBtqB0vVQHNkfE6sJpFBkmCAn37E5CzhQmBEp3d/4Y3XWFRzEL/XqT+q3zbC YMJmy9KAn6OgOoZBoe3NMjNnQGq2eK9KnnZqGHoioOLlyrk1LOy1EoX9L9C7UB1LYOdW +PlQYDw+WFPkP8qORjXK1lwlhAcsI6wqAT0WKxC0knuJYbHihC4DV5+AoyP5xZ93PKEk KtCxI33+e13RLhCw0uSrZjPo3YT/StcQ5lF4IAg9EhNZ4XQ2Ri+C657chfqJC0gmvK0+ gXiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728378029; x=1728982829; 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=WqvSXxv/sXZh4YDTgQXsf5TmgeATsSUVXTwwhzFav38=; b=RqmFX+sihZcn6ewq97u0+feP4e9P3zwdpTAiO3KetGTqNZsUc68orCbclXw4WIomez dYVHA1BJi8+7ZTUOVgrdCt9E4ygiz2VEdDzmotT0W9bY9TPKmfEaEpu+T/xt0PT5dM80 bITFFBHYGT48Cm3ELEiZreyo8o6glXwErxDK9uS1JJxoAU8tMa3qG1PGKaXURwyHSz8f fZOXuJGtz0WVBkvOC5uSoaLQWUXj8vE3NBhEksBfdXF3ZxO44s3Gq1+uF+6uC/QU1fXn s4kDOAPgRyO6hHy6oARsfa7xvoCGjg25UyR9ImXBcE+xD1U7Q+4i9PDYFi3XwzynCjUm K3DQ== X-Forwarded-Encrypted: i=1; AJvYcCVUNnl0v9aRta9f8C/CkKBojLAZ1szQmLsrCVpJlSkm5ejeoTyvRNmcB0p9VEHmqySXpF2BAwByUG0QDYwCQ927@lists.infradead.org X-Gm-Message-State: AOJu0YzY/31NpUnR18EnMLyZz0pzzpvg7NVnUj4o5oshhMsWaxo2yOvg I7Pzifm9ux12JSw0XsSAt1Ab6F32COcc8Qwzk09sS6VYxQCd6/RsWvYSbWNHzzs= X-Google-Smtp-Source: AGHT+IFnyQZ00WTesS7K+tvwWCInNJHE2ElAD+QHyyO9zbJNo147gVcQXc2DQgTrdqZeOoQgnFBBVg== X-Received: by 2002:a17:907:a4d:b0:a80:f54c:ad68 with SMTP id a640c23a62f3a-a991bce2e1cmr668029966b.2.1728378028617; Tue, 08 Oct 2024 02:00:28 -0700 (PDT) Received: from [127.0.1.1] ([178.197.211.167]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a994e6e571asm294701166b.85.2024.10.08.02.00.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 02:00:28 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 08 Oct 2024 11:00:06 +0200 Subject: [PATCH v3 6/6] thermal: sun8i: Use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20241008-b4-cleanup-h-of-node-put-thermal-v3-6-825122398f71@linaro.org> References: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> In-Reply-To: <20241008-b4-cleanup-h-of-node-put-thermal-v3-0-825122398f71@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , Thara Gopinath , Thierry Reding , Jonathan Hunter , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Chen-Yu Tsai , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1794; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=FhSSUbYjEIvtsOA30smmw3DQZNhLSc6w/jfUrv5pJGQ=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBnBPSfE1YKQx6eHCEVnRKeY3oZT2E67IuVgGqTh yKvFuSWE12JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZwT0nwAKCRDBN2bmhouD 1//PD/0a92e+IdVlo1Rd94IpF461K36Nbu2qEwIl8Z7fifaGiJu7QHKtVmk47ZohZ6B8ygJYuXm T0qST14kdxL/AXy/Y23FX+h7AETR5L4omrqBZwsIcD6EeX1ap7QKpE9Ir8kjlTurpPf4N9XRvEP ZhxUCifgdhjpf5bHjGF69fW8S76we++KAKPCJJXV2YZ7NEM0TL6zbkJvcuOXsVXtMnmqZohB/Dn 3SjUZKT2nWWBEZAJLm++7ll2iXeue5bZReaf55ifDGSEGvht2vQonR3dTnaHAC8NMTsdlOHBIVv +MAN3obefMgGDXwMlSlxI4DME6H+LSJ/PUzba99CpgbLug+WFpRGodxXjNBEfJWlG2sNGWYWdd4 NuciO0D92ILoNmqk2paqYfM+BW9yanrVfIusWnDfzPt4iwUupv7/9+C+vSYkaMCRbo1Z8EyLy8O ot2Yoe91ibgcUCIjXx1o04tJ2JzP1rZFx4guOdjJvHMvvG/ZTKXcUiQ/SIkMupPathCMA2jCdwz wlXL5F8KSRRw0s5MaPGsrMh20yBKEgblq8+vPrNkJ8Lf8Oes9PFuNLTEqjJJgJEw9KgoL36/2zG lVpIywoGSVHcPjAotUE9tFiDT4q4ibyUp7Qt9HdKh5yTFk0qOmu3YaDG9gQer/pxcvTE/OjrctQ iYfmhRS9ItI4tAA== 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-20241008_020030_736316_B863F0B3 X-CRM114-Status: GOOD ( 14.89 ) 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: Chen-Yu Tsai Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/thermal/sun8i_thermal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 3203d8bd13a8fc2a9e5a59b3547cefc2440542c6..22674790629a7b549d1ce618998ff51f6553613e 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -348,19 +349,18 @@ static void sun8i_ths_reset_control_assert(void *data) static struct regmap *sun8i_ths_get_sram_regmap(struct device_node *node) { - struct device_node *sram_node; struct platform_device *sram_pdev; struct regmap *regmap = NULL; - sram_node = of_parse_phandle(node, "allwinner,sram", 0); + struct device_node *sram_node __free(device_node) = + of_parse_phandle(node, "allwinner,sram", 0); if (!sram_node) return ERR_PTR(-ENODEV); sram_pdev = of_find_device_by_node(sram_node); if (!sram_pdev) { /* platform device might not be probed yet */ - regmap = ERR_PTR(-EPROBE_DEFER); - goto out_put_node; + return ERR_PTR(-EPROBE_DEFER); } /* If no regmap is found then the other device driver is at fault */ @@ -369,8 +369,7 @@ static struct regmap *sun8i_ths_get_sram_regmap(struct device_node *node) regmap = ERR_PTR(-EINVAL); platform_device_put(sram_pdev); -out_put_node: - of_node_put(sram_node); + return regmap; }