From nobody Wed Nov 27 22:29:47 2024 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.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 688D01D014B for ; Thu, 10 Oct 2024 18:06:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728583607; cv=none; b=LFPslISayjIKcqDhS+oDw7vNMVArvF7GD72FfqvbaycUviNpPzK5XXzbtuPA7PX6kCSnwiO1PdOlnF/w4rS59wXH93jSKoFAsRCjqJ57QRn2d04EEKqUUeh9t2Ftoqf0aA5glO7SMVHlaCsi3O4YCJwUwqHH8mR6jcEVtMc0h3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728583607; c=relaxed/simple; bh=wYClXJKWHiD7HQHxTZ+cA0c/iCEus3r1K31L8rg0g5w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=seWEeznC/34DkHEf+ux3snGsU20gLv2IArjLrNfPbw4iXuMVU8GScXSdrnW4YRak3A7vpROo+43BXMOgtCfjn5gp7Q/jNaUkZBxfq/C7nLx1Kx64aG9lAsDRAuPYvFzC90JEmMaEE9ROO5xcJdCNNkfX03XP4MSpCXkQZlJ8z9A= 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=nWHk5IC5; arc=none smtp.client-ip=209.85.218.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="nWHk5IC5" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a99409f1cc7so17518666b.2 for ; Thu, 10 Oct 2024 11:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728583604; x=1729188404; 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=zNHd9uOUFYMvCAXebRo/fjYtsxyYPOLWHoAaGWoy1tE=; b=nWHk5IC5HdSoGnlWGLsrvwI+TxX5BcP9e4naSk9yw2kclbmyPY0Qp6k1k1UlM1rAM3 1WAfX/vvKjbLhtICBPZneOXouH7U+nbWBGsadNEJEKJ+7h6f6zk+40fVdhQCB2uHec1z 6B6Ibl65q5tegbgm6RLk5cdtzCbDvR9gjJmFwlpyJHB7/w7AHHJzHfcN/d5anGintbju N2Iut4g0uuv5ZmO3BmL8EYqIcfYQ8xEDQhcK01MP93dbbCl6JeVqoDQJ3g9x8CjKDC96 mtEVRwHJzQQhOhaNvt61hr7fFsqw8scIo2olyp84MR5iIuxHddlGkiir1VhFBQaoLnpC o4og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728583604; x=1729188404; 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=zNHd9uOUFYMvCAXebRo/fjYtsxyYPOLWHoAaGWoy1tE=; b=NhJoVJiE1aEmCyjuu1QMyp1ulzYZXeR3TkPoRYPyEa2+Wb1+pyRJkC0uYHNuIJCula YeDiAB0OK6iEAv6Qv6BLGt9Fuq9t2nUnCV85HW2NrrCfamGn+ye4ro60xnJiTBmfVduJ jYFtrtiNW7u7p7P0EX3lMN+SBgQMvCZ1A3G58+DbKGeisvpOm/O4ooOEQk1K4JNJdIG0 g28Jbbs1MkjKUACMKsVkya/QJqukV1rabtVZx/W7lBjcLnAIvtEElVcPoYmOF9AjVelD H7EJWdimenyQdhqTLkqeQsnVZXXABGPlq9GqY6fdhdglVjOVh8qMK0yTEtAgvEpcB9FN CfYQ== X-Forwarded-Encrypted: i=1; AJvYcCUfV+g6dTRSMd4KN6KhLLQoGu9tVjCosqJfX69olMTS7odch/bH+aFdV7LJ1UyKp1rvy81pqEouv/Z9Be0=@vger.kernel.org X-Gm-Message-State: AOJu0YwtPoQOTpKGd0+7qWxoJ34DwL5I9oJ4L7gGk2mO0OgHUJRpI2LJ m+5E1qRu2wl6rzS4E5y462h+oT5g6GrrMaqeOVA8nMDgsIIsjXy7MzRCmK99ll4= X-Google-Smtp-Source: AGHT+IHXG8VaZInUUFAvxb002JlgmJFHrC3mhFZJAVtrcbAFOAxaAouRcGLkivAX5NM5oRoVFuCHnw== X-Received: by 2002:a17:907:d24:b0:a99:8cd3:5810 with SMTP id a640c23a62f3a-a998d1f64c8mr283223566b.8.1728583603840; Thu, 10 Oct 2024 11:06:43 -0700 (PDT) Received: from [127.0.1.1] ([178.197.211.167]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80c1b8asm119757966b.116.2024.10.10.11.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 11:06:43 -0700 (PDT) From: Krzysztof Kozlowski Date: Thu, 10 Oct 2024 20:06:22 +0200 Subject: [PATCH v4 6/6] thermal: sun8i: Use scoped device node handling to simplify error paths Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241010-b4-cleanup-h-of-node-put-thermal-v4-6-bfbe29ad81f4@linaro.org> References: <20241010-b4-cleanup-h-of-node-put-thermal-v4-0-bfbe29ad81f4@linaro.org> In-Reply-To: <20241010-b4-cleanup-h-of-node-put-thermal-v4-0-bfbe29ad81f4@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 , Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1855; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=wYClXJKWHiD7HQHxTZ+cA0c/iCEus3r1K31L8rg0g5w=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBnCBekdByvAQz7PIlOWkUvsQ+WBs5zS53VgUcf0 2GuMObk5cuJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZwgXpAAKCRDBN2bmhouD 1/yKD/410uKcFyGlvzO15ze4hOKRpWLw5V67Kx5zo8B43YJaHxuSHUBpoOJeBWXrAQgdtP2GXzE l/qxBeSvhw3/GFyFCDOYDyG6HtkW3qO5tIqx8fVOCxHTiB0yf1+boloOALHg6vBDKdpzDHOBUNK b1YDa8X9+f1mk6f0pxvVyfKWfO5Uviy/aQHM1dc5Ccm4dZo8U3j7EQH4upqTCjjavpifP3MY3oT HuInbdw5jbjjlFdpo/ol4J4bSkwdH/4nj3349zrPrfnZ7SQOapQwexeoXfSXuKCdR8CgZDAb3cp O6LB80/4qxIJeiIbZZtgaGrBLXKSGT1g+T8er0tzcd+tA1SyZK6ZPB0wDH0pT7CdWrIhdpovTEM hRfI9tQsU0s5vI6wuU3DiNNP6KGsVqTJ6HgqBpCnQT2SeeJb7/Yn/rHj/+H5rPV61vr+8hNj8Lu qPy0HtHZAK+Cc76xRkB493/Z1IYRLJy6P5Pqumw+2e2OrmnG2A8q+IiwbWFOZ27DwwAfh1F1rjk QrLJV7lq513bxJLg9IFDzSO4lp4ZeaZH5wAmI0CM2u3/AAkkcZSblw5syk2ZrqWBdHDWtr4Vdnq l1jmQTDe1UvwKHwTbNvQBUJswCUTUtCcGKAadL/Hpd3Zo2rxZxtBcYQyKvZAHwIKsBif/rgIoTx pIR+Lgn8zsIoDqQ== 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. Reviewed-by: Chen-Yu Tsai Reviewed-by: Jonathan Cameron Signed-off-by: Krzysztof Kozlowski --- 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_therma= l.c index 3203d8bd13a8fc2a9e5a59b3547cefc2440542c6..22674790629a7b549d1ce618998= ff51f6553613e 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -9,6 +9,7 @@ */ =20 #include +#include #include #include #include @@ -348,19 +349,18 @@ static void sun8i_ths_reset_control_assert(void *data) =20 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 =3D NULL; =20 - sram_node =3D of_parse_phandle(node, "allwinner,sram", 0); + struct device_node *sram_node __free(device_node) =3D + of_parse_phandle(node, "allwinner,sram", 0); if (!sram_node) return ERR_PTR(-ENODEV); =20 sram_pdev =3D of_find_device_by_node(sram_node); if (!sram_pdev) { /* platform device might not be probed yet */ - regmap =3D ERR_PTR(-EPROBE_DEFER); - goto out_put_node; + return ERR_PTR(-EPROBE_DEFER); } =20 /* 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 =3D ERR_PTR(-EINVAL); =20 platform_device_put(sram_pdev); -out_put_node: - of_node_put(sram_node); + return regmap; } =20 --=20 2.43.0