From patchwork Thu Oct 10 21:25:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831182 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 2A2BAD24454 for ; Thu, 10 Oct 2024 21:29:03 +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=NP8lfF3+tt2bERQMe+43qAzEv8h11+8hyUY3IsdG9dE=; b=NIqqDY/tybl0VOX1vMe/hc57/h JKL5QE+yokANOyy6oUTVtKeP6muoZ8Rjyhw1jkYo1HOp7m/79dBuQUh73G/srIBVMr2pSuPHBzaAi bvtX8JznG5nrV3kIrISIHow/TCID7ihWahNVI3uGfr/RRMJrRIoZAK/YsqB++VHJyCIikJ27PtHaW opZ5pngy+reHXIWzT5dEKX1uHnhDScBJnAIcbJd3N/JW4gIoxc0x6Xla8Mkx5KBKIAcq+DrLg62aG 212w4/V9ERVh26lTKrbewcTb2HEGK9xJarS6DEBEgZa5u/vPnu10nfG8Lhlgba/ttZCOTOS89rzIL 22WoiQLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0iM-0000000EPd5-36AY; Thu, 10 Oct 2024 21:28:54 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fa-0000000EP3D-0vrC; Thu, 10 Oct 2024 21:26:03 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-37d495d217bso1024771f8f.0; Thu, 10 Oct 2024 14:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595560; x=1729200360; 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=NP8lfF3+tt2bERQMe+43qAzEv8h11+8hyUY3IsdG9dE=; b=ekS2NQvWC5D57LKgHx7cXEWfIGUpvYwOMEEcwZqdZ76Qj8KIXnS+vC3qwWmeP0w6Ia z/K+BJ9q3r/iyZ8Sq9F4DPkx4lnk/81H+tHCYBdLprGqWEpBg/00R22+/xqklI/orTun S4VPyKgDYWrWEkMRsx/QoVMvl/HHHEXCfdZ9BZqJoxWi+XMs9iOxsibTI9jxqEf4nd7r XMcXrZYzLasPXBnZ1EFxKNRKe/oHBUbwrJdOd8OzJko/IpSceaO3Z/uIcogSApvQT/jw mYPTzQFkGzuOyfSsqJPE5L0PNY1oVKt307Wbw0pX7+c2wymI4pjvygkO6eU4yhb6kSwj j6XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595560; x=1729200360; 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=NP8lfF3+tt2bERQMe+43qAzEv8h11+8hyUY3IsdG9dE=; b=C7DpwWnlLo1Lv7UAwlsGXnYDs3LdVSXo8c1EzZ596kUkiNLR6QVkTbt/BXrm+benoq bva+fZb0Ub6Y9D/1Pe/PnTqxDQDuWsI2CAze/EIG2UPYVaK43ThaJfmxBPFBYqgkwAB1 nVQpHRGXQWsRveZML+bf/yjE8N0WzgiyWC+EgCIpTNfgJuA16Kieu5SOg6M90WK42kRm QgGvqxaf/E6ABhiqgPlHGQc0LGYVh3RcgNDG+K7BJ75RrLiBrmUa+nSF9Ge1875QU2Pn YAZE/3LwJO99P13osB5bnIOhwwFoFzm00zFnWFf+WWwmTvvGNFF0SZY9pxxxXZw/BvW5 26HA== X-Forwarded-Encrypted: i=1; AJvYcCVZZ1K9kjs0hgkd0HqzZHqf6TTDT8dSwnx2Fs4DYSrhqpq8mqCwdt8Dwn6XL2e9CJ4icK4h9uH2kydHiEt+lRCO@lists.infradead.org, AJvYcCWJOTjhPyWRdowENzTSgH4h6S2S5SZ1TKUbkKdNTWrhN6eP8GvSV89lMHY7Q5fPzzGRfrlirncDdLd0kOq4Ez4=@lists.infradead.org, AJvYcCXF6h1Xca7THrFJAQpMrOiIT1DK1Gspw2PXxIYnwqIkQO45X9tHhhOAagS5ZwfMBhC6BC2OXgVhlJtEgesezW0NcA==@lists.infradead.org X-Gm-Message-State: AOJu0YzUh9CNdGW1yIBH6Gl698PI2fC5HGdASpdzxjKhmO57XLM8pORO /7Y/Sr5x+1FMpVCobkZ4k6MehdKjxEyRDR5jNPguc9u3L43tGqzNdYSO1tcV X-Google-Smtp-Source: AGHT+IE4KFtceqWgFI5Exk1ggU7gG6fN1lLUM7411oUgT6YiAdrbwe1U80pIh0+6rzapsH7z+JsyYQ== X-Received: by 2002:adf:f585:0:b0:37c:d1ea:f1ce with SMTP id ffacd0b85a97d-37d551d53dbmr354861f8f.25.1728595560283; Thu, 10 Oct 2024 14:26:00 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:25:59 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:25:51 +0200 Subject: [PATCH 01/10] Input: cap11xx - switch to for_each_child_of_node_scoped MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-1-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=1675; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=t9fa1o1a5Sgyy/pkELwXsraoor0CZUbJK+3ORgewgNE=; b=b31gP7WKvaxSGCe8LGxC0VFmrQkeU9+dZDzn0FUk6fhSEtR5GsZSn0RkT3Hsunh8on+1vLtSE bY5XwOwbB/8CemBxLFfFlFJk8eGyd/NjIzj/SvQvHebIoHP0HzSadpD X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_142602_298911_BA6BB94E X-CRM114-Status: GOOD ( 12.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 Use the scoped variant of the macro to simplify the code and error handling. This makes the error handling more robust by ensuring that the child node is always freed. Signed-off-by: Javier Carrasco --- drivers/input/keyboard/cap11xx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c index b21ef9d6ff9d..0c17cbaa3d27 100644 --- a/drivers/input/keyboard/cap11xx.c +++ b/drivers/input/keyboard/cap11xx.c @@ -416,7 +416,7 @@ static int cap11xx_led_set(struct led_classdev *cdev, static int cap11xx_init_leds(struct device *dev, struct cap11xx_priv *priv, int num_leds) { - struct device_node *node = dev->of_node, *child; + struct device_node *node = dev->of_node; struct cap11xx_led *led; int cnt = of_get_child_count(node); int error; @@ -445,7 +445,7 @@ static int cap11xx_init_leds(struct device *dev, if (error) return error; - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { u32 reg; led->cdev.name = @@ -458,19 +458,15 @@ static int cap11xx_init_leds(struct device *dev, led->cdev.brightness = LED_OFF; error = of_property_read_u32(child, "reg", ®); - if (error != 0 || reg >= num_leds) { - of_node_put(child); + if (error != 0 || reg >= num_leds) return -EINVAL; - } led->reg = reg; led->priv = priv; error = devm_led_classdev_register(dev, &led->cdev); - if (error) { - of_node_put(child); + if (error) return error; - } priv->num_leds++; led++; From patchwork Thu Oct 10 21:25:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831667 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 73D9BD2444F for ; Fri, 11 Oct 2024 00:46:33 +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=82HiPSULHr+FUteMSvvyK8noRcXFrMRkdAs1zK1bpjI=; b=u73GjMKaeQGKReBE3EuWyvF4hV MazBd2ewHphtCCh0JMAztEBeQ9vFbTGA9HkYjqVLLMitDXmHg8cAh+9Fu6uwCkRas0KHQp37ESQMd XK4ycv7GNiam6Wm1R59rE8l4UmrvPokXjVewUDXMBIMMDizMRXZ9SKfknKaz1HJYLFliFk1tcfUE7 YPCgocZ99dg3yofvUCroaju3F48zsvSiQEXwrxIkMbP3Tv1kT6X02AqLb6BuChbyIGBN1DygxDbw+ ShmT7T446KHHpg354RvalvxTsGdgZnURr/qfWpIrzwDPDJrGSpg9PO9CPt3E0w/fVbUsLktgYa5Jh fTkr6pAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz3na-0000000Epua-3whB; Fri, 11 Oct 2024 00:46:30 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fc-0000000EP3j-3F7e; Thu, 10 Oct 2024 21:26:06 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-37d47eff9acso719074f8f.3; Thu, 10 Oct 2024 14:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595563; x=1729200363; 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=82HiPSULHr+FUteMSvvyK8noRcXFrMRkdAs1zK1bpjI=; b=hkXNJud721eViSGp6xC1idpcQDbDt6X+y/Ya5cPBnNzQNtP0t2kcCWnc9P/Qmbtsbx xbVMz/o6/JVVXnnOKr/tCbKNZiqUx3OKwSM7yWJe+Nt72NJzJQZzuoFvASodeCWTOboI Y+BnStnGaSFz2JamDdLXv6V2CXa56sNHU0qJHC02rO5MXr+AtSL9I4OVedKEE4TMnN3i whGB51zvIHmjpp8ah2Ts4O/usUYLd4JSY1tcZqUWfJ6NJ/JpI2X3R3tTBPjNu/7RcSYe CC8HduUf0cnklw3z6dJ2E1Sw+n5Qt1B3Hqw+o0vCoPmnpMD3Sbk6YOzXiUL2pGj79LMK /yqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595563; x=1729200363; 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=82HiPSULHr+FUteMSvvyK8noRcXFrMRkdAs1zK1bpjI=; b=TFxX8vYyXBr2L1K3PuCAA0qSIVqNHd6xdZjjlChQ5JsPEGWjLWug1nC/ayhP1oCVqw Y7OiYHukik3Z8/awLTF8T9+6KWtiBHvVoryEZHduxOKfI/zqE59NPGOGV7l1tdOkWjr7 QMnzOGW7r9oLZy1Qim3h4L6QmoFBMa5NxkJtvzKXqBgmS2vlWmocYmf0wkDp8chHliXy BXZc4QSYNwbEd5AOnR/Ntoxp4sD7bmV9QbHx7jPM+1H3UgNlcRdn510DNf3km+CNHsO8 D49RqRCAy+mJqgn9EpTqeRsfpI0lhvBwgetYEMV+OwjXxv6pCV96XVA4Wim4IuFTSrVz /mBw== X-Forwarded-Encrypted: i=1; AJvYcCVHaadbcDiR3Z3hOH9zjhkWrtfw/1kAmYslkH1rp5H2TTPAeuFEXiQsNSxhfU2l+pKKJFJ+/n3lg7O0+vgth0c=@lists.infradead.org, AJvYcCVnQqQB2EiY8YHSf6nwH/c7tfhmVEjSNHWwkXShRSXXedIVOfcZTX8jod1PjLuHn5wCvr+55JO72GwLVoat9nGRdA==@lists.infradead.org, AJvYcCXCHGRvjjmSUHhKJHL4lNWJerpWaarTjqTw1LLw+zYV31pVSVUIdX7+0yixsxeiCrU0+nO3aTz1VtU4zmUe0RVB@lists.infradead.org X-Gm-Message-State: AOJu0Ywl6uOTb9Jtcn1u7YsLl+K40nKJnCM37lO82Hz5eF4ibOF0VSGP kGYicNt3u/oO1pI3itdRB5gTursr3XUch2h/CcB3cPMhlh2/bjuV X-Google-Smtp-Source: AGHT+IGXFqB+Zazmp7zehHYuM+XL6z61pYXfmG/3rSEoRILp6KFB73i+GbynVFHLtM/y3xRgpb0hmg== X-Received: by 2002:a05:6000:459b:b0:37d:37b2:385d with SMTP id ffacd0b85a97d-37d5519118amr285252f8f.12.1728595562834; Thu, 10 Oct 2024 14:26:02 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:26:02 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:25:52 +0200 Subject: [PATCH 02/10] Input: mtk-pmic-keys - switch to for_each_child_of_node_scoped MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-2-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=2458; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=VnsjVhq/mttVM6JYsQsLgW4CuzOsRfVPLIHizOJxOgE=; b=ZS797SMZjCf7D8Lm77tFOx/ESKZizmB8NLX/9NtgZRCNy1/Qe09aBZ6jGgwJT+aYB75Bagai0 S9JU5B7IeC2D7sgZK2eq4Xtr8wWKCnkMDiB1XWjLJ0wpWwKDsfmLIhB X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_142604_857586_77EB1471 X-CRM114-Status: GOOD ( 13.64 ) 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 the scoped variant of the macro to simplify the code and error handling. This makes the error handling more robust by ensuring that the child node is always freed. Signed-off-by: Javier Carrasco --- drivers/input/keyboard/mtk-pmic-keys.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 4364c3401ff1..5ad6be914160 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -307,7 +307,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) int error, index = 0; unsigned int keycount; struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent); - struct device_node *node = pdev->dev.of_node, *child; + struct device_node *node = pdev->dev.of_node; static const char *const irqnames[] = { "powerkey", "homekey" }; static const char *const irqnames_r[] = { "powerkey_r", "homekey_r" }; struct mtk_pmic_keys *keys; @@ -343,24 +343,20 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) return -EINVAL; } - for_each_child_of_node(node, child) { + for_each_child_of_node_scoped(node, child) { keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index]; keys->keys[index].irq = platform_get_irq_byname(pdev, irqnames[index]); - if (keys->keys[index].irq < 0) { - of_node_put(child); + if (keys->keys[index].irq < 0) return keys->keys[index].irq; - } if (of_device_is_compatible(node, "mediatek,mt6358-keys")) { keys->keys[index].irq_r = platform_get_irq_byname(pdev, irqnames_r[index]); - if (keys->keys[index].irq_r < 0) { - of_node_put(child); + if (keys->keys[index].irq_r < 0) return keys->keys[index].irq_r; - } } error = of_property_read_u32(child, @@ -369,7 +365,6 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) dev_err(keys->dev, "failed to read key:%d linux,keycode property: %d\n", index, error); - of_node_put(child); return error; } @@ -377,10 +372,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) keys->keys[index].wakeup = true; error = mtk_pmic_key_setup(keys, &keys->keys[index]); - if (error) { - of_node_put(child); + if (error) return error; - } index++; } From patchwork Thu Oct 10 21:25:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831273 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 8F60ED2444F for ; Thu, 10 Oct 2024 22:46:36 +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=J/PQS/8RbHWMjns+hXbfTHhQVRn54n1C6fHMniju3VI=; b=n5scLsMvRTMdQQ8IuiGJ7TnLj9 taS7PbktZMFQk69ef4eWDDjaGr3445nlWeiTS1T99xVDYoNIuf4UQ92Ev5t0OohRCbmHY+yI7/pvn rGuuFBE47d4Z/U6bw9mcygqodFAdtUuctUWDr2CH0BbRhqSojms7FVi5njkkxeaaagdDLz+0+Pypy 1ulPqMCgtDVJOfYXlt2AyuqgZp5oqAYDEcfh6SB1mw9fYc2T9QCoxW7noI7nx9qrwf/Ow4RSdrusj h6e3jzNNAKMMWPMNOFat31I8sn34tzafGWToVfojFzDAQN6GZrjz3jfsvXsGdcN9xlzlOPLLpiUDH QqBt+J7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz1vP-0000000Ea59-2W1J; Thu, 10 Oct 2024 22:46:27 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0ff-0000000EP4K-0YHP; Thu, 10 Oct 2024 21:26:08 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-37d4821e6b4so742156f8f.3; Thu, 10 Oct 2024 14:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595565; x=1729200365; 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=J/PQS/8RbHWMjns+hXbfTHhQVRn54n1C6fHMniju3VI=; b=hdxNhDmROuihr3J6sriLMR6SYxcpS3lpW8YDaymhRbRGbAmTmh70tJD7eiSTTpK4lP B4AYsU3DdVh8ad49vZLi0q0+tol3XQiZL/sNwVlBvyy8V7pjj8vmyfUmkIEPY6Xz7Omo u89I0spKhaslv2z1vGhkKjelJkf4gpgPUL2KjDkx3anOog7C6DMXRAWk7MqTyNRzANbA P/Jl8s3vcizIslPUD8MLZMpPCc0qW9PvmdQQH9ZU+N6vhmWfBi0E2Tcc0Skwqm+2mHte 7locgivW5wupIfOecNfDgt9eg/g2KtFaWXvhUT+6Ui3Tq65+qeVLw9SX8ER933LkJew+ a4zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595565; x=1729200365; 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=J/PQS/8RbHWMjns+hXbfTHhQVRn54n1C6fHMniju3VI=; b=nRntByxercVxqJPr0g3lC4y/cIVVPF97qkI1zgJD5U2O3/N42kDdhWPZWUMTe+Pm/z 7VTdQsWBQyegzYk9G6FUA/hlEnLogkPOETboGod+HPpVSVPGoDSoQjQx1ZieNbYSD9Mv kgEba1BU2sgZThSIqCrC4utpL8ZgaYIUMa1FB+f0/Wzd8FXwsp5Fj2T5F9c4hMcD4xcQ lUOgwozViwKXaes02ZMJN6Rrlwle2vQ6BDBDB9TOmO0gL4Hr84xMm9uDONxZdNelDAuT KaMkRq02JHMJAyFc/6jnETTmOYF/g91wS+ZD1sP8ijsesb/hXW89tjciLNKwegxZlxni R6bw== X-Forwarded-Encrypted: i=1; AJvYcCUDlJYCG9649CyamfScw+5PMkYTPUWa0rque1AuLY1QdXwlJY1E91yngn6KLVfu7BLXsfEuOu/HIFPho18t5fE=@lists.infradead.org, AJvYcCVJ8LVHfVLez8UHWHQUiawK9iDRDQab5ABN7HA5ZCKyctOFIpvJfk2cmLCZstlwvKUGpNaSAqduPcKN4fv+f8MV@lists.infradead.org, AJvYcCXlw/JqK8qvmyH5Ng0jJKLMUEgc1pKRQUjVREHRLwsc223gHY2pxk28k9fGO/F+Tu6RWsWpA9XzQkDjqIDCteympw==@lists.infradead.org X-Gm-Message-State: AOJu0YyF67lN52DTX0n1PHK0HSApjk3J3e1pgkQd4RxbA1IZgLDFZ7Pb mbhqhtEJIAdPt8dSjqcPfk3wq863M0rdLQADsE67TXaX5WZ/x3zk/P//4Trn X-Google-Smtp-Source: AGHT+IHTagaYiTqDEo8/KQexjkWrhnQ6PMf/Wmq6Gqr6clYP1OUl5dQgDZmTtwi4XEpJMk2I20xVwA== X-Received: by 2002:a5d:4acc:0:b0:37d:54a0:d0a1 with SMTP id ffacd0b85a97d-37d552cdd6dmr236882f8f.56.1728595565212; Thu, 10 Oct 2024 14:26:05 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:26:04 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:25:53 +0200 Subject: [PATCH 03/10] Input: sun4i-lradc-keys - switch to for_each_child_of_node_scoped MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-3-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=1723; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=AF25XcLrg1gJJCZ0loQqPaYtp8vI7GzZlTAbicwO06E=; b=wi6sf2KQfPxfVmYIPTgXn9ICUj6hhr2iRzOEK7JHXtgg5cLEOvCV7676G+F2C2arErdMBYj3d bSCk+w+kbPfAlODbaQuyP1b/Crwa0KT5OQkJ8a44SmYDIBq6lvZCcZI X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_142607_209739_E58FF595 X-CRM114-Status: GOOD ( 12.55 ) 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 the scoped variant of the macro to simplify the code and error handling. This makes the error handling more robust by ensuring that the child node is always freed. Signed-off-by: Javier Carrasco Reviewed-by: Andre Przywara --- drivers/input/keyboard/sun4i-lradc-keys.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c index f304cab0ebdb..f1e269605f05 100644 --- a/drivers/input/keyboard/sun4i-lradc-keys.c +++ b/drivers/input/keyboard/sun4i-lradc-keys.c @@ -202,7 +202,7 @@ static void sun4i_lradc_close(struct input_dev *dev) static int sun4i_lradc_load_dt_keymap(struct device *dev, struct sun4i_lradc_data *lradc) { - struct device_node *np, *pp; + struct device_node *np; int i; int error; @@ -223,28 +223,25 @@ static int sun4i_lradc_load_dt_keymap(struct device *dev, return -ENOMEM; i = 0; - for_each_child_of_node(np, pp) { + for_each_child_of_node_scoped(np, pp) { struct sun4i_lradc_keymap *map = &lradc->chan0_map[i]; u32 channel; error = of_property_read_u32(pp, "channel", &channel); if (error || channel != 0) { dev_err(dev, "%pOFn: Inval channel prop\n", pp); - of_node_put(pp); return -EINVAL; } error = of_property_read_u32(pp, "voltage", &map->voltage); if (error) { dev_err(dev, "%pOFn: Inval voltage prop\n", pp); - of_node_put(pp); return -EINVAL; } error = of_property_read_u32(pp, "linux,code", &map->keycode); if (error) { dev_err(dev, "%pOFn: Inval linux,code prop\n", pp); - of_node_put(pp); return -EINVAL; } From patchwork Thu Oct 10 21:25:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831272 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 00E30D2445C for ; Thu, 10 Oct 2024 22:46: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=fHWRZlXxWyBjeMmMTHiCSMSAw8Pbb8irSTDpVqQUOvo=; b=vlrIZWW3fWMkHZA76kOvmS9FDF 1Dr7eUWzkdnh5BzwtB7FJ0HWFrRwfMPI5oghJAvbs1esiWzd3xYm0eyw9zg1X7M/43i4bUzfvCT0C JCdjKeSGyhcd4WhqUa6oFyIHmLMXJSSLSu4CD2/JwkAsX/UD4tBvjbDE2tMZTWDfh81DxImCpd8um rYBozZVNUfCaRoS6fQKUeyS5JS6U/0dQdtxNa+2339aTEzAR1ROTxYZM160fQX3n5p04IB/oSJuhJ QUnTpQotOSMoDHBs8604r8gYrbqeVYmErCRgLUB/iKXexMQMHJ3uLZ/+q5NTnkv/5zTivN/TkmEfD EewoXJtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz1vQ-0000000Ea5f-21s6; Thu, 10 Oct 2024 22:46:28 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fo-0000000EP6f-0X1Z; Thu, 10 Oct 2024 21:26:16 +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=fHWRZlXxWyBjeMmMTHiCSMSAw8Pbb8irSTDpVqQUOvo=; b=WoLmjiGXrBlnGUJzVJPI82he94 KNpIxsArIVJ8ztHuVDH+/xLnJ4cej9xPa05sZG9I7k5+BYTkhOHnhirh6M7fkWazKMmfRno0tm7w6 FCFsA6GVrutWlXqfIXviKjOZg1ar71DwBFhnxm5tLYdzJ0+iCZXiYfwEt2qUmbKtCTu/765cH7Ai7 VbeU9XrvbOgKzvMaWiSvSBqBWjWP63j9m4ek0IPUdRLqRhAe6BE+ritClmSh5ROEX1ISKDajnM09Q 2Y1IDT9y2kAEYQ9BokmMyWdnQy3WcNb292pI5Y3PBeSS8X2q318120cy7c3iecH5+xvWtSddiO6Ni aIX8VqeQ==; Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fj-00000005fdl-2LJA; Thu, 10 Oct 2024 21:26:13 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-42e748f78d6so10326185e9.0; Thu, 10 Oct 2024 14:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595568; x=1729200368; 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=fHWRZlXxWyBjeMmMTHiCSMSAw8Pbb8irSTDpVqQUOvo=; b=hfOO8Qr3cfdTTivpmXhDYZZd2zPM2aTn7DlOShR/nEj3SKLxRQu2BrvPF2zHZLfOwQ AVnR5gfg/xIeczuO8oua9CGQ7xyc4cP8zttngmBvGirVF6477nwDG3gLT+otpA2FpKqE 3apcY/M1CAOkIXF1c0HWXfmhf7/W0yhSWFD8PF36oZohNShNzaj+zvisKxq49HVw3fL+ yPBa+tXNd1+YV38n2/tByjvsMksExXoAgnHq7NDhnI1SJw3r6S0yF3JiLrTO49rNL77F 0Avi2GnrrIV4pCNjFz84vMuP+a/v4IDHTeeKsfvl2r9bDYKmGEdf9cW7xlIMDNDcIpSo 8Hbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595568; x=1729200368; 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=fHWRZlXxWyBjeMmMTHiCSMSAw8Pbb8irSTDpVqQUOvo=; b=cNpRm4WN9Qeqagmf7tkOo5ocv08WcycHmPtJFd8FGdxqvgHR8kopT38osZpBxVdsaB 4yhJFXu7kZ1syopL1L/OoxyeMcxOsvnMTHEV2dk3XPSNshUONmmvLRk+Ujc72SC7ZM9D f8k3tMybeOqH/U/Zl10OfolIf8LcfMHDqS1lZpqn2hoGfgpjvBOjjvlQe9cgRkJhD1XN Nz1I5sCqmdZF/5su+JGzGLqa5O8FM2k+BjmfQER52NQltOQbAfk6xfPJO5TyCrrfBt6b kfjdHkgAdG2nwIlUZJbY7SE6xd+Lv2j8RaGKiaLZTCmChyF29qoPp2KuqrCPTgmeEXRU 9ifw== X-Forwarded-Encrypted: i=1; AJvYcCUZRzYR3r2SjTgLikiIltWqxEZxQ5OfL9NdxHmBpRKYDcx52iWbqMvvLcGP4KfofkhwyYKw1quNU1mrlvLoKFmh@lists.infradead.org, AJvYcCVAGtpdNCQnwlfoMB55a+YOVkIVhxuQ9ps9w9dQTMwtSSrCbYHxS6SLOeKR5BRsooQRO+UqF3X3aohlWNIjigU=@lists.infradead.org, AJvYcCX7ESUg9jwrQqDh4Awc9/UW9AxJogI6NDUPtCia5iX0dJlrPbDjvL0H5EeVZVUhpnYjejpz7sDu8DE1oqNUoIevKQ==@lists.infradead.org X-Gm-Message-State: AOJu0YwTZ4f62nRF2nNjJqZz9Uf/ifybgjfBHI38Y5IepgojbEA8jibC J3K+CsuZQzq/Tf11ajyVtL3Ig/aQLR/I4HAsJlLTrSa7f4gK9N5f X-Google-Smtp-Source: AGHT+IH29d2ZIsfU/u9DFVW+6yCWUZ10F+EwzMZ6/EKx3GvDGWDTA3iS7grS2mWveZO8jUN402sziQ== X-Received: by 2002:a5d:6843:0:b0:37d:43ad:14eb with SMTP id ffacd0b85a97d-37d551b7365mr236307f8f.14.1728595567520; Thu, 10 Oct 2024 14:26:07 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:26:06 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:25:54 +0200 Subject: [PATCH 04/10] Input: twl6040-vibra - use cleanup facility for device_node MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-4-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=1953; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=tDYGmTbXvdvpbRFG0IrCSIV47mvFQRYsGGj+NcIIddk=; b=aQSM4gB2oKRbGTKDUnb+JrhfhsQ4SuW3g/7tQuRTKwxhS2Fu6V3AEwkunPJT91s0uiqLyuOB1 PpjDY5LHIRBAvqrVdAPip7Uj9SnWp7iBwmBWmqkARDaPeBAPVRV8kuS X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_222611_787372_43348D71 X-CRM114-Status: GOOD ( 13.17 ) 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 the '__free(device_node)' macro to simplify the code and error handling. This makes the error handling more robust by ensuring that the device node is always freed. Signed-off-by: Javier Carrasco --- drivers/input/misc/twl6040-vibra.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index 78f0b63e5c20..afed9af65bf9 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c @@ -229,14 +229,13 @@ static DEFINE_SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, static int twl6040_vibra_probe(struct platform_device *pdev) { struct device *twl6040_core_dev = pdev->dev.parent; - struct device_node *twl6040_core_node; struct vibra_info *info; int vddvibl_uV = 0; int vddvibr_uV = 0; int error; - twl6040_core_node = of_get_child_by_name(twl6040_core_dev->of_node, - "vibra"); + struct device_node *twl6040_core_node __free(device_node) = + of_get_child_by_name(twl6040_core_dev->of_node, "vibra"); if (!twl6040_core_node) { dev_err(&pdev->dev, "parent of node is missing?\n"); return -EINVAL; @@ -244,7 +243,6 @@ static int twl6040_vibra_probe(struct platform_device *pdev) info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); if (!info) { - of_node_put(twl6040_core_node); dev_err(&pdev->dev, "couldn't allocate memory\n"); return -ENOMEM; } @@ -264,8 +262,6 @@ static int twl6040_vibra_probe(struct platform_device *pdev) of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", &vddvibl_uV); of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", &vddvibr_uV); - of_node_put(twl6040_core_node); - if ((!info->vibldrv_res && !info->viblmotor_res) || (!info->vibrdrv_res && !info->vibrmotor_res)) { dev_err(info->dev, "invalid vibra driver/motor resistance\n"); From patchwork Thu Oct 10 21:25:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831187 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 92B2CD24454 for ; Thu, 10 Oct 2024 21:33:21 +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=Gv2lnH1bFL+wtFjxRgBI14o1ODjTXUiEC0mw6OfkCr4=; b=zHf1tcP7RzOWQkM9Z+CPRkA0gT qpU5+wecowipehdIpw+FOfaBr5E9ONCdtdFa3mGGHUOt4eXq/XGZYbRXuqU5R08kpvw72vXEjfxe2 kTNUv+3RfIXSd1ZXl/EGnWpedh/vh8ffxKkCRhUvmKFwds7ggYtH9HOYn7SJfTrbv5RRiC/1n7Pcd 8K2g8PY4Dv7/2q+H7R3SiJQaZsuktF7mncT06MNq/UhurSLDkUB6QWjf3xyvV9ch4P1YRSEDKYVkr J9K+XzvX2LrVkRHe9i9wAvpPLEV6aQmYjqMnJsS+AMaSgmqSwsNiLo/4YHi3AT0ZiSVnZRlwlkn/C uRNuGaGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0mW-0000000EQ35-3m5U; Thu, 10 Oct 2024 21:33:12 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fk-0000000EP5P-12jG; Thu, 10 Oct 2024 21:26:13 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-37d5038c653so535503f8f.2; Thu, 10 Oct 2024 14:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595570; x=1729200370; 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=Gv2lnH1bFL+wtFjxRgBI14o1ODjTXUiEC0mw6OfkCr4=; b=FrZKvqXA/3kCP0SZ+Sb6LMj1QBzpsUUR+smS32frwjD9bbil2Q4XTSE9Iu83Q7Jryg ZthrzAGs9ZC8VGdEBlUQ6c8NoFk8Fg2c4oM5/lgRvUJPAjwUR/dSxWlqozj8S2S2P7RD QmizfITd2lwnt5p5+UkOP3ABZiSNO3E/793d5FWZZGuwR8ybHVcxGvvmELWHswCVSd9B KWYleCmhMloXbtViNvd4jQCysWBfSgj9SXaR24TX7+SjaRF7Z9jxxGS1FqmVbth5C28L KSwg91LgPQxyEaJIzQbc4MKcBc5ZYWGVmj7O0uyRq9iFEo+qoqIBAIXcU0a7FKuWOFVS DoJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595570; x=1729200370; 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=Gv2lnH1bFL+wtFjxRgBI14o1ODjTXUiEC0mw6OfkCr4=; b=fwlYhR3cHwzNjnyMzUkyE8DlYKvqu0a9PO6Nc0XIfv+KcIdBuyToz0/K4/y6r1gNGL 854P5jcA5kRujzyL/4fvd0RjE+l0J7RRopjNxhX1JakRGtQq6wW51z3015Ix/VNJzh6N 91Kt6erepnOT5X5JRCdfu89Cepx/NOZL5Utwb8m5nQSKzCOio4Zp5nEr79USqJwnAL9M VF6aM4q3VIypco9wxEv2AGTOtF9GVc1QJcFYidNrcOu9Mm7+dHxwXg1QnZKbUxMOT6j1 bqBCgY7w9MrqlXPH64vZ3SSyvaSnFeDm5H+N+mTvhXIIe8HWn3oVm8ZfjOZ8jG6ysOC/ 90xQ== X-Forwarded-Encrypted: i=1; AJvYcCVC7smsscjBQnFX5kYUkgaZ2Ugmq8ptQyImSg/+89Cw4/u0xZboNfCqm04LVIDoztXNZDFEshZY7frqYAjvg6U=@lists.infradead.org, AJvYcCXFaEBhL1ziQQ93IBDMe/hd2eWvHrsdBYhifekR1+n8gfYdGBapNykd/IK/IvogJI3DPksCaWC5kyRPIDMoEftGMg==@lists.infradead.org, AJvYcCXyJ6d/eTnfrxgXzTuI/W6h3ZfB2hNwDK95lvg4BdSwsDfzCr3Iq/WO6e5XrWXwuRfRAT6ovOuFG9iJG30aSia4@lists.infradead.org X-Gm-Message-State: AOJu0Yz7784Cf5AWQoVTLz7drI/7o20qWRRy8w8Bpi5Bb6G0uyMJTZE+ +I/Vduic/CHRjgmOk+8nDcfrIWT6L+OVXluUdInrriK6/L0j+5IwzU1LW6KG X-Google-Smtp-Source: AGHT+IHrNABpkE9MoIs4OHjPtix9N5xn9oz/4v1rJOCBX1LbPoC+c+XJfnpTq5HfizfEkADdbQPIpw== X-Received: by 2002:a05:6000:1092:b0:375:c4c7:c7ac with SMTP id ffacd0b85a97d-37d552cb121mr309436f8f.49.1728595570453; Thu, 10 Oct 2024 14:26:10 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:26:08 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:25:55 +0200 Subject: [PATCH 05/10] Input: twl4030-vibra - use cleanup facility for device_node MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-5-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=1014; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=8XjuIi1Czg4gxADzAUScoPXbznvngqAftxkGhXUC4pg=; b=/4+JFcJpLeL4D0LEVXjbes3plish7dWoFirHhI5dayVbYW4PEtxEp0kTrBT1nHE4UHbh0m0sS RPzjoyarLQcDfkWazC5yuILBtuqtMJaAHXEwwvzs+7J+Ee6KQ/9rewD X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_142612_324832_AE9DD4EF X-CRM114-Status: GOOD ( 11.04 ) 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 the '__free(device_node)' macro to simplify the code by automatically freeing the device node. Signed-off-by: Javier Carrasco --- drivers/input/misc/twl4030-vibra.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c index 101548b35ee3..b8ec5c7c5bce 100644 --- a/drivers/input/misc/twl4030-vibra.c +++ b/drivers/input/misc/twl4030-vibra.c @@ -165,15 +165,10 @@ static DEFINE_SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops, static bool twl4030_vibra_check_coexist(struct device_node *parent) { - struct device_node *node; + struct device_node *node __free(device_node) = + of_get_child_by_name(parent, "codec"); - node = of_get_child_by_name(parent, "codec"); - if (node) { - of_node_put(node); - return true; - } - - return false; + return node ? true : false; } static int twl4030_vibra_probe(struct platform_device *pdev) From patchwork Thu Oct 10 21:25:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831191 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 7E988D2444F for ; Thu, 10 Oct 2024 21:36:09 +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=T6P7FJOWA2mY2iTIPWe/1vsKU4sSdy22YB05qi0Ew68=; b=OPake3Lfn4lRkqraHE4GNwD1l/ +c8BVfJjeGuHvSXqz6d8APrKJjmn2mZAy0gZXU0u/uQbGAW7N03V0BVLtWARkO7pSwSp5gWv7LYD6 COqyiHgTZI8N1sJWWL3ZW8fcDxxMY2B6sOA2thuFaisa2iJhNIkpp+vsxAjp3Bei1I+YOdMv9rXOz RCGr+z+Ck1V4Y5Ys8A21SnPOy2HIWkLrrgr8+/m7YAEQB8id/GO2J4hqK6/mTdLzmx4CwogbvE8i3 vTwQMsgSMKG/ixuxBL2/Ewn5QRZRUEHGvKjdhRgb9qH7CNAIEmdMLBizs7zqtwrQ4eSs6acNmOe1O QDWzpLRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0pD-0000000EQGt-15wa; Thu, 10 Oct 2024 21:35:59 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fq-0000000EP7L-0d6V; Thu, 10 Oct 2024 21:26:18 +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=T6P7FJOWA2mY2iTIPWe/1vsKU4sSdy22YB05qi0Ew68=; b=WhuMMcvSR4/L6X8MTGTaaYYaxK Hh1wubP190wrZc9N2ODFv/sWKUFRi/LSz6FvDRVN1wzQFLCoKWjzzy+ULgXigGI2XNmu9mmH3lXV8 w3KxDPP/9Dx00Ft6pUzX/DFNutyLEEH5VT3sNQT1wrf9j3vLvi7tjwi2etgLoEE553uQ65V0tCYHw vLPg8cEkuPTFCpgmkBhT84wXuySyzmKBNum/MP8IWVoocWIYLTuQJ5PvXLPzLdS08LTcvzqwpWoCR 1Y6ccdEtbq0LoOVZDS8pV60b2w325w6yWZyLeC8zv9BqLedKRIxMfX177oDIH3ur0plMjV9HABzs+ BV5dLgog==; Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fm-00000005feH-3vVp; Thu, 10 Oct 2024 21:26:16 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-37d47b38336so768738f8f.3; Thu, 10 Oct 2024 14:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595572; x=1729200372; 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=T6P7FJOWA2mY2iTIPWe/1vsKU4sSdy22YB05qi0Ew68=; b=Z1Unwjmm43mAvGaeKhdoCxHhgdCEVBw/r2dz/48P2lIZb+1Du0rKTzlJjf8xProvRg QiIElF1UJOCtFCl8L6vUNk9JYOFCJInbc7WuIkVwdAJkgTwnihTaJUlvBf/eu4gZYjUk TKOG1wraQpchhqNvnMpV8AkJC8+C978jC8tmuM75ho64A2pbz0PX96wcVil8nt8eraBN 493e7Chs9+gMhCCN9c3a+vmxD5fgAgjN6H5R9PuxOOEyzv/Jyni3qDHxSgolP6eW9iIL cLlJWe6Pk/vJu6hPWeFaOAyfIGrlb5TEuMPPHu7nth+sGnOIyqymht9xiqj/L2/d38GN br9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595572; x=1729200372; 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=T6P7FJOWA2mY2iTIPWe/1vsKU4sSdy22YB05qi0Ew68=; b=RoOStLVmNNbsavnKtX2HiVQBBQdEt01vgGyil6npEPLTAOA0bu2sPI369MsdoPnB2k XPRhN7ox3NzRFlkIgZKWYseXdlp+MkbAuZmBJUNpcZUJ/XvMDyZg44W/cs28QJjMgwSu 02W9D04fmimsnbfu3KbKxZ2oiZ4bvwnhYmhTqPx5OVjBUt/Zamt/BzsAdNn/rU8L/jHe Pmck/iUWmMUkMgF30jPvGIkhvp8rjuyUqzVo5+CeIFAvDTUPJEIvyGvgwyvuIDSNZULo MDiv+clLY2jQXjJhmlyt41WPK4xWY/+af//4BM7uWyAhhJBlHBH5ymCDGMbhv0ToMxDx LOXw== X-Forwarded-Encrypted: i=1; AJvYcCV60x7gbH5VJ8pQ1ICiIPi/ZLR0TldqsETgsf9k/GvzTp0Cgrn4Mrugu1nAwVP9iPY66QcgZddSwINbZPm9vIBxeA==@lists.infradead.org, AJvYcCWYTiTIiNpnFUKReLr4PRgEDjMSpwJUmV3jq3ZVtr/BXh2jgTnomY8mb9EDOIyKwfc2o37gw9e6pdrrxGwWa7g=@lists.infradead.org, AJvYcCWlq6c5313squvF6c9g8gNfG6eVPw/7bM7XvF5MLQ/8z6Ld+OrIqIyXtgCczfJw/tODFiCgm5LWbds0jjhAdf3W@lists.infradead.org X-Gm-Message-State: AOJu0Yy3lfpvIeDaSlzuzCmBmzRv8BJ/xVbU3Fq75uYAfRyI/fM6I/+l gqAM55jpqvrjbH8DZV6Dkp/qQa8OtYYlptY0Ed3lUm28du2dTry7 X-Google-Smtp-Source: AGHT+IH8aKF7ZsrrRJ3ZAqBCFliO5puHhZfFhiaORhFDWMLDX5I92S5u/UpYGz9iWlpxdFrHyFPBzg== X-Received: by 2002:a5d:4fc6:0:b0:37d:453f:4491 with SMTP id ffacd0b85a97d-37d5518f628mr265658f8f.8.1728595572326; Thu, 10 Oct 2024 14:26:12 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:26:11 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:25:56 +0200 Subject: [PATCH 06/10] Input: sparcspkr - use cleanup facility for device_node MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-6-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=1254; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=f+TcIDFO1FofKlmr06Cec6JytdWs70QlHA84jUACDyU=; b=rSoTsyqTSVQaxGJxx7Zk2ybfk4klIzu0zmDb1G7zEN3+e165HJnqYXSyzN09nq9Rh5EpSBTea SN2ySImkHOKABewNi/o9w3aNg+p9MtGzaFTKn16I0mkRni86QdhGwvt X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_222615_101029_D828B732 X-CRM114-Status: GOOD ( 12.81 ) 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 the 'free(device_node)' macro to simplify the code by automatically freeing the device node, which removes the need for explicit calls to 'of_node_put()'. Signed-off-by: Javier Carrasco --- drivers/input/misc/sparcspkr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index 20020cbc0752..bb1c732c8f95 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c @@ -188,7 +188,6 @@ static int bbc_beep_probe(struct platform_device *op) { struct sparcspkr_state *state; struct bbc_beep_info *info; - struct device_node *dp; int err = -ENOMEM; state = kzalloc(sizeof(*state), GFP_KERNEL); @@ -199,14 +198,13 @@ static int bbc_beep_probe(struct platform_device *op) state->event = bbc_spkr_event; spin_lock_init(&state->lock); - dp = of_find_node_by_path("/"); err = -ENODEV; + struct device_node *dp __free(device_node) = of_find_node_by_path("/"); if (!dp) goto out_free; info = &state->u.bbc; info->clock_freq = of_getintprop_default(dp, "clock-frequency", 0); - of_node_put(dp); if (!info->clock_freq) goto out_free; From patchwork Thu Oct 10 21:25:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831192 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 F3197D24455 for ; Thu, 10 Oct 2024 21:37:39 +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=vDpMMaqPXUoFVzi9A3PDhKb1T42MjqvUb4kdLnoWycw=; b=bWps1U2frQMhYIrCCSHXjd7tvP rG1sr4LAexgjQRqD1j9k3g4LrfeQ0CufTv7jmoRP8EMkuy0sZ+2fABpT7jYD7LEmYJ4bBufTEl8Bb MLcE4G485uDwqWMADX5tl1Mezq6+iJ+1dvD98BN5dTCZhrBiYpoONjHyy6ZovVSkqbElCKZ08s41o Xr/NYO9gbF1QblXXtmEwhz0+MK9YARfZwm+dhEEgveZIGxH5MxgcOD70XLqkJjPvngQ3VExeCMaFS /W/98syebptFILa5isviu8qmyhLb+hDFdGDIA9H1xDydonoZs8jL0oKgi2vdG4W/X80DJezHOB4Va gg93sMBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0qg-0000000EQTM-2JpF; Thu, 10 Oct 2024 21:37:30 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fr-0000000EP7v-25GD; Thu, 10 Oct 2024 21:26:19 +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=vDpMMaqPXUoFVzi9A3PDhKb1T42MjqvUb4kdLnoWycw=; b=prxxyHv7VvbENinXmPnJF9+UYB ZqFq5cQWI1/uwhgBhBd8gqhSeP2H3cbhFVWGZih3SjI+N97mWwLFmwlqVrSfN0+/l/r8Efw+A1QPK ylq1Yw4TlR1FD7j7wGseTKW5e8ibPaesxJyKPBQkAl9t+r7kTN2WUo599T5I6Ghw2Zir84M1bSct2 ehVyVBsqJ1VQUVIv0h8iYRGgZ1UvNyc6DUlomJNwMAuYjc1yBauiNsJl4VNmZtv0YxrM7Q6SjT0Ws GuKNsRM8gNk8tFe5cU3/KtLMbgSLY9rHI8acCLX+eOEd922HDCdLaB2Io85APuhRo13q534FiZ/of H74pl0XA==; Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fn-00000005feo-40eL; Thu, 10 Oct 2024 21:26:18 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-37d538fe5f2so232672f8f.2; Thu, 10 Oct 2024 14:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595575; x=1729200375; 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=vDpMMaqPXUoFVzi9A3PDhKb1T42MjqvUb4kdLnoWycw=; b=XOWNzVCxmia4wKc5byZqxsuVEIwZJ0UCnvn0mr9P8WUyuCOscTs5G8UnqSKSxsAoYN U59xOejHqm+R31B2TqRLQIXfqbIV37jU/2q8ioRFIV8NiOz+n2BqJ3R3SDBBAKpgzOVS 3qg9mAinImySE04GK45JIfXbpSdsUUhLcgUSFXq1XCn0bRVOJGDf3CNRh3dtMK+Du3rm LZCFmRMzQz+Fr/9cKunbZs9HeiWrDQCy7B4aexz9TFBX0ptK6QYwKNkGfwa4ZFtUSHCG +sBWKsZe8+/zDAP5DOzup3QV1+MNadTldZalL+7mm0GV46PyW6rFp7LmEpwAojsCUG9E WiRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595575; x=1729200375; 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=vDpMMaqPXUoFVzi9A3PDhKb1T42MjqvUb4kdLnoWycw=; b=uKzQ91qTCD2xsZHd9QxDa52+E+9RTsaNjxkETNR5HFNZNwGLnsBbwZvT4H+zj0buiy MlSmwZ53geroeP6Z00NBVLV2nZLdKVGBw7kWKcsWUloKFPE9x+/9z2Nne99OlM3IQR1Y wO+gy+2ge6UqOmdQ/td9oegYcVz1Z4ARAtCGGYgIy3kVoIojgWumFb07LPhOGyuK3ilj xMLM6aAQqfCgH8cexI5Ck5P6g1AWXp/R8BHQC7RAz3UbIt1TScCttj1LXha871UFTWKd sgJW9PcQG+gnG7NfOxK6nRWqs5S2eorilXV8HRLvetovnyrco5Flj+va76y7RmfRJGex DYiQ== X-Forwarded-Encrypted: i=1; AJvYcCUm3FzYNkS9BouHXVsakGQOWK/mW0nu67amp4AJImb/x1KIAmWc8Gku1prV1gZrXeRgMlcsMq2aavfR6lXfj8Xt@lists.infradead.org, AJvYcCUy1QuVnsE/qvKQMzdQcG0/X4ue/cDydpNbbTMcZN0LfwW8SXcItrDa6zSDePO6UuFpggH3vYQQySs+az1nQZMseg==@lists.infradead.org, AJvYcCWr7GMFgKFg8qHwZtPmeg4PT+d65gUECeCFNm0yGBqVGN1V44qgYnbFrKrD9ZaZAk5kcLVDaNVLNUlwB88fzYI=@lists.infradead.org X-Gm-Message-State: AOJu0YyT0IO46JLXscpyTbO5pbjVhmMQ6Up2hTctBy+OAGhUETEbP61O HJOzpGfM6M4TK23Zp7aw6kqFuSmndLAHSGJ8K07ltGiawC/BZFAe X-Google-Smtp-Source: AGHT+IHdMahvsk2hiPcLQLFTajRterRsAVRoLlPSao00sFi2GHvdnhGLq5Smgs1qAUipDrz8egxq6w== X-Received: by 2002:a05:6000:1203:b0:37d:4e03:635c with SMTP id ffacd0b85a97d-37d551d512emr359593f8f.21.1728595574599; Thu, 10 Oct 2024 14:26:14 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:26:13 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:25:57 +0200 Subject: [PATCH 07/10] Input: 88pm860x - use cleanup facility for device_node MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-7-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=2328; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=TCHsuzKnwrSzC8ELBgoH5r2aJODW1HU03jHewVR1CdI=; b=xHiUPq+0uEXEYbsSevTTOS03OD5A3ZbaOvxx2BJWcX2dzwkxmfC/OCrEYTRrgYVjPrjRoPxHD FE5yXQzgkTbBtgRrI9dLa6stp5BoMUgaC+F6ClAuNoxJm5fgiV8x+tC X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_222616_282989_30DDE3CB X-CRM114-Status: GOOD ( 14.16 ) 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 the '__free(device_node)' macro to simplify the code and error handling. This makes the code more robust by ensuring that the device node is always freed. Drop the first assignment to 'pdev->dev.parent->of_node', as it was only a shortcut, and tie 'np' to its usage as a child node. Signed-off-by: Javier Carrasco --- drivers/input/touchscreen/88pm860x-ts.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c index 81a3ea4b9a3d..0468ce2b216f 100644 --- a/drivers/input/touchscreen/88pm860x-ts.c +++ b/drivers/input/touchscreen/88pm860x-ts.c @@ -117,13 +117,14 @@ static int pm860x_touch_dt_init(struct platform_device *pdev, struct pm860x_chip *chip, int *res_x) { - struct device_node *np = pdev->dev.parent->of_node; struct i2c_client *i2c = (chip->id == CHIP_PM8607) ? chip->client \ : chip->companion; int data, n, ret; - if (!np) + if (!pdev->dev.parent->of_node) return -ENODEV; - np = of_get_child_by_name(np, "touch"); + + struct device_node *np __free(device_node) = + of_get_child_by_name(pdev->dev.parent->of_node, "touch"); if (!np) { dev_err(&pdev->dev, "Can't find touch node\n"); return -EINVAL; @@ -141,13 +142,13 @@ static int pm860x_touch_dt_init(struct platform_device *pdev, if (data) { ret = pm860x_reg_write(i2c, PM8607_GPADC_MISC1, data); if (ret < 0) - goto err_put_node; + return -EINVAL; } /* set tsi prebias time */ if (!of_property_read_u32(np, "marvell,88pm860x-tsi-prebias", &data)) { ret = pm860x_reg_write(i2c, PM8607_TSI_PREBIAS, data); if (ret < 0) - goto err_put_node; + return -EINVAL; } /* set prebias & prechg time of pen detect */ data = 0; @@ -158,18 +159,11 @@ static int pm860x_touch_dt_init(struct platform_device *pdev, if (data) { ret = pm860x_reg_write(i2c, PM8607_PD_PREBIAS, data); if (ret < 0) - goto err_put_node; + return -EINVAL; } of_property_read_u32(np, "marvell,88pm860x-resistor-X", res_x); - of_node_put(np); - return 0; - -err_put_node: - of_node_put(np); - - return -EINVAL; } #else #define pm860x_touch_dt_init(x, y, z) (-1) From patchwork Thu Oct 10 21:25:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831197 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 281AFD24454 for ; Thu, 10 Oct 2024 21:40:31 +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=fUDTsje5EfzdoMuNeif+3YwfWRAgSWK+tp+b+is46Rk=; b=xiZduaodQQljFhdNcthYI2c4Un p5GD0ze8woZO6MJlobw894jwxYgguOwrYFuZffSNdspZIFcGaQk7BuTm1/DVXGDdPH9yi+Ec1Svyr v1KRTU7Jf0PurzmNcohbE9o+zGrRh1C51rbwllkH32bt84MdMg0kg8xnE27RrpwFX6il9IjlC9VAR DWUHoW8O7FAfx4u9UiZ/AETnTkFups4rniiHm6Wh2lJskg00YTUstvBmtqVECyKZ+dWv1bFy6YqvC 1Mb/PJewva1WfCNB7bkybPyiHh8pLujxuDdCV+utiAA6jP7FjEa1UeDK/qtsO7l1gY7GQ66QsFA74 y0wOOBIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0tS-0000000EQtp-2rzw; Thu, 10 Oct 2024 21:40:22 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fu-0000000EP8r-3n6B; Thu, 10 Oct 2024 21:26:23 +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=fUDTsje5EfzdoMuNeif+3YwfWRAgSWK+tp+b+is46Rk=; b=qalTHx/iUCw3C6/CCRfu2etpWJ rvYKjKu71G1sh9YBldQfIvAHH0kIltb5EJx65oNT4V6Pg9IcefRYR+BSDLm9k+ujsk3qRQfM6c6E1 D5qgfZQ7zlFNcdaGBAg25jvoPu2Jt1AFVtTl2tPkxJuEQhv1a9sjurCsaVgr0tyh9/2Wp2HMenaux JpcfpaWMu+K6QL5tA4rwppiSV0/AmP+fkd8E3xBBZ4N5xq66Gilxi4oEuBfZGRD7/wUoIQZfiEARq hu3XRid7ixiqRofmO1nXoK4tQz7bCZnI+5fJmSV59dRzQNzCQGR9pBdAnJ5RbCzaO5VISwrUSeohM TrNNdqVA==; Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fr-00000005ffD-2FKf; Thu, 10 Oct 2024 21:26:21 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-37d4a5ecc44so767200f8f.2; Thu, 10 Oct 2024 14:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595577; x=1729200377; 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=fUDTsje5EfzdoMuNeif+3YwfWRAgSWK+tp+b+is46Rk=; b=a53XYebZZqXsyxdl8ooZSK7NYwsZUSc7MRUmmQKaxhvZBFTLtYKi5jYv6f7K+aGyVV TZci72Wuxikjyy8L5XcSKjNOFb2E1XP/zRha/o7a+KH6YViH0wyKR7qU6jx8Xg+ulaoS 2ymXQK9WnnXJMYS6HZC3cwSdWC7/touXQ27Jrv5+3WDLxgJF7vsnk0bgpA8cbSgxZwMj G9p1qIDX3c1G4kDeDRIdKSpJgakJjzGO+HO2noEOvzRNkhp+Ohbxt493faNnyLdNYDoa gNEJ1GBzkqg6+VUDUIA8jionSc+g7I6PyzzNbkHVGYJRaU5nHM2gaGPOxkXebVrMIUj8 fm+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595577; x=1729200377; 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=fUDTsje5EfzdoMuNeif+3YwfWRAgSWK+tp+b+is46Rk=; b=T6/l06z0p25cnhvdyyPsWV58v86hjO3kbVMf11QwnvLSBT9hJnxUwwPdZ2mjfTaUBJ RZmlEA50CdPxRwkIUeRb1k1SMLokuxmSrYO/xcfsdqHoN3rS2Kn7yx/gsLyFpEte67rZ rwmzNRZRLJZyGZBjwXN6o7MtTw4OZvW92/3kiXGlvRiHlvDg2OXRbQI6KO/p/po2nHlg VsphdEJff7RK8TFhb3b33mBYppCHSfhXxawNWQt2YfN0Ra9+EKQ1D5MT+18yD53LN0/v F72PKQTmM9ZHcc2A1EZTVLJaTT2u2xVCMdXbcENnHIBQZIofUSapsfAa1S4RFzi0LgfB 7gdg== X-Forwarded-Encrypted: i=1; AJvYcCVAuH9WKQXnndZPGc00BTb1ZMzZXyx5jpC2sptv7PRffZ9XKbh/2sJQ/6GqUb7QWN+0nLfBFAchPhxuguq3E7hs@lists.infradead.org, AJvYcCVGOX1W+FC7XpSa4c42A2ww7J/x/4A04Ud0aYDjZyAo/ubRt4+VlxWAxSo5zvhWQLguE1epES9ML7SNX1HRi4A=@lists.infradead.org, AJvYcCX8P/cgaqVE1yMYemM+P+SvXcGHf3biNvq9scanMksbezZi2CBtfn03wk67ZGX7J954LpBiZs8QCQBnLAHsBmUZlA==@lists.infradead.org X-Gm-Message-State: AOJu0Yw3DRDF6/BDUe5dVJNgcp/n9qYpYET7qAkkWIFgsbN7DcQGJBEd 6oQ46pITuaj03Q6GFarJbc7Xp1kY5LQof4U62DUkkkT6qYpa/z9x X-Google-Smtp-Source: AGHT+IErfYIIobd2OyStqSYzXYY8mQXAN1McuuX/JaESc8XSKGTQGWz4nicjCFOz7wSr2wv2o2OOOQ== X-Received: by 2002:a5d:6645:0:b0:37d:4e03:ff86 with SMTP id ffacd0b85a97d-37d55313314mr307553f8f.49.1728595576937; Thu, 10 Oct 2024 14:26:16 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:26:16 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:25:58 +0200 Subject: [PATCH 08/10] Input: i8042 - use cleanup facility for device_node MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-8-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=1046; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=osj1On2Z4WQ2i4hQXIWGqEGjGF6nBC2nMsxNyB0VvTE=; b=jnKPKqCaHxm+V0jnKxBl/3/ALs7b4E092gZ+6qqIEjdd4p92lVndVLYBkmFyIyZ+Riv1vvWHl EyNknbnL/FjAys5GQDIwfXUWt02P6ak3U6BA9XJn0TyCcEaSZ5CS/sI X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_222620_075183_293AAC88 X-CRM114-Status: GOOD ( 12.32 ) 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 the '__free(device_node)' macro to automatically free the device node, removing the need for explicit calls to 'of_node_put()' to decrement its refcount. Signed-off-by: Javier Carrasco --- drivers/input/serio/i8042-sparcio.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index c2fda54dc384..8f38b6f4ae77 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h @@ -106,17 +106,13 @@ static struct platform_driver sparc_i8042_driver = { static bool i8042_is_mr_coffee(void) { - struct device_node *root; + struct device_node *root __free(device_node) = of_find_node_by_path("/"); const char *name; bool is_mr_coffee; - root = of_find_node_by_path("/"); - name = of_get_property(root, "name", NULL); is_mr_coffee = name && !strcmp(name, "SUNW,JavaStation-1"); - of_node_put(root); - return is_mr_coffee; } From patchwork Thu Oct 10 21:25:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831193 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 D49D1D2444F for ; Thu, 10 Oct 2024 21:39:04 +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=zmicnpp9cd9JtqZFSnHyB6Y93ime6LMtu/deyDIKcMk=; b=xu2daQGHXt1x00dr3J++YYgOt2 beJkrwgi5JnDt/v9Njz1QFfwUceGP7LKNrrEMSTboOptVYu1JQjPHbFDRSGzhq6YzMdyVxbsdt8Gc q3Agp3CW8FznIZ5FUgVOu98VjGa+AFoI9/9cLTdollAtltSRw9yyfyfjxtDqBic6e7slH5qdLMzT5 WDiZZd+VQxowZwf15On5EQ4VW4dbdtAqWiw1dtBkERmxTy11ZckxNjN9hJlU5Xx3+pryxbbGUpM5E 4wBf+VnaRCRzfEngHPkgN98s4iD+2/92OvUEP4MPyn9Ima5NhAWwrJTU/It8S/WhZGM8atoeU0++5 KmJ1oSZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0s4-0000000EQeJ-0UDG; Thu, 10 Oct 2024 21:38:56 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0ft-0000000EP8Q-1g8W; Thu, 10 Oct 2024 21:26:22 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-37d4a5ecc44so767217f8f.2; Thu, 10 Oct 2024 14:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595579; x=1729200379; 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=zmicnpp9cd9JtqZFSnHyB6Y93ime6LMtu/deyDIKcMk=; b=Czm9T8vE4GOM1Kpph7qiecEdE5ihsw/6qyZUT2U6taS5O925eSpuHL5PaS48rSuFvY k1X4VwAphf9HCMeOoqVeDhrMJFvwbe2yAvAJKxPvZqZdqa7tIZ9C33tNQGI5+4O/GMwh 172sSLf8XxhlQrMM/xFPab7e+bQJhqbMbs8jE/mZYHjR48ZlJVREmWuBE1xhuOBYI4yo CVM8rCkIsr3pnqJbb8PXlq+f9xvnUkTmO8Ubd7ehd9qwl5bAraKvzGBihBOHIYvLmJWH LpQBb2gw49qmWp9kZpO2eSBAhkqUH58hXh056a5orFbNj83P8C7hlE3EwALv8RQGRqoN gWfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595579; x=1729200379; 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=zmicnpp9cd9JtqZFSnHyB6Y93ime6LMtu/deyDIKcMk=; b=qu+VeVBqfLp/EitXM/XjJDPPYYvd0leNh5YL6KZOVfcWp30uOHdw6XSoMAtDwHvSq5 atkx6m5PbvMhNmbIXI6G87fWYiAn4NwV3dZD4FNtFmc9nLtf6rq0gkV8apELoLX5kKR/ kWJe4GP14MMwOCKIRAS6bgxUvJf7Z9cVdJqTHdZCDEPoFYniIiaxPx9gTWIVQIY4dVbv TW71MTqYxdKFlHFKHQXTYl8r/9rSOppiPdFX9xriVNzcsCxN8LMyhRCltnVSnDPjBR3W zEk6LtkkhBYl+YST92pwv4TEeGmTNC47wtxGkeTiXk5GkZOheLxUrNDp92y57dZWCyDj MW3w== X-Forwarded-Encrypted: i=1; AJvYcCUaMj2P6VSmHxiO1aYXvbedN+QmNEycsf2dtTui06nyR8nYpvm14xXSUIm3SWe7uvgHKYq8vGYzzh1p5rzli/S7@lists.infradead.org, AJvYcCWCSavDSVwXpqHsyTqY3T8dXjPS/MqFIhXeKuONYHypcSXCoN+ebtA6YGx1wZTbvT5US8b75WX3EWy09LtrHy8=@lists.infradead.org, AJvYcCWI2m06LQ0vVLeAaPfLysoEGGOCsOHT9oKIgetpuMH2pl+UVF2etb+TH1bY3nM2RSzqjM3ddsryqtBWXWA88EM/3A==@lists.infradead.org X-Gm-Message-State: AOJu0Yyod2rR1hYjTdDV7JHzpoV89TTRvSPoHpvvUCWtQYXNIXX2EHzY bocRlPN0Z6IsJfNFFCXwfkgPQpraFUlE28PawkuSx7DcE/dwse2b X-Google-Smtp-Source: AGHT+IF35HrnKs7WD26F1nGHKplWO56RdKrMZQ7OOp7vbg+9vF8z0Burx6lY8GWTwDksnELnrk9jIQ== X-Received: by 2002:adf:e90f:0:b0:37d:50f8:a801 with SMTP id ffacd0b85a97d-37d5531323bmr302685f8f.47.1728595579251; Thu, 10 Oct 2024 14:26:19 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:26:18 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:25:59 +0200 Subject: [PATCH 09/10] Input: raspberrypi-ts - use cleanup facility for device_node MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-9-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=1209; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=qaHmN1vj3OJMngtAh5LlltSL6miuty/pRQh556o6ku0=; b=e1/0RKq2raIunj/4RBLVw/Zc3mleb5v6VF2G0Gas11OFUKozTrqrF4MulYBCUvD857OzZgntV dW/x3ybOLxPDEqlxp2QL8JWTqTMc0scMnU0b57l0w0WuOer7yfMUZp7 X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_142621_474116_C74F92B8 X-CRM114-Status: GOOD ( 13.01 ) 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 the '__free(device_node)' macro to automatically free the device node, removing the need for explicit calls to 'of_node_put()' to decrement its refcount. Signed-off-by: Javier Carrasco --- drivers/input/touchscreen/raspberrypi-ts.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/raspberrypi-ts.c b/drivers/input/touchscreen/raspberrypi-ts.c index 45c575df994e..841d39a449b3 100644 --- a/drivers/input/touchscreen/raspberrypi-ts.c +++ b/drivers/input/touchscreen/raspberrypi-ts.c @@ -122,20 +122,18 @@ static int rpi_ts_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct input_dev *input; - struct device_node *fw_node; struct rpi_firmware *fw; struct rpi_ts *ts; u32 touchbuf; int error; - fw_node = of_get_parent(np); + struct device_node *fw_node __free(device_node) = of_get_parent(np); if (!fw_node) { dev_err(dev, "Missing firmware node\n"); return -ENOENT; } fw = devm_rpi_firmware_get(&pdev->dev, fw_node); - of_node_put(fw_node); if (!fw) return -EPROBE_DEFER; From patchwork Thu Oct 10 21:26:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13831198 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 D3389D24454 for ; Thu, 10 Oct 2024 21:41: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=0+l713dFhBMpKSXKC6Fm7N/NzG3LTu7+MrLDSBO7iRI=; b=CR5EGmiXgU+spbFMeU/TrPPjI1 p3MOJKeEm5EeF5dir1Hv9HWOwbMrmdwVOceYHdihI1m53xamx4HqTXAf6kfOmUV3amERhdA6OVjIn 7vUaeyqbobol3wEV2OygMyDta25obUXfCndt1XjnP+ls1xlRjndy2FepR5eXWsVnQWk2ErWFMtrob PAbreR5EGLPHCV08m4kYZyxtrdp7dx5SCRIoh8dfF+XuQxBTTbo8neohk8mHAZPTuW4lEY94P7hj8 pqRZ6c10FxQpt+uUkGmiF7k7ZwjzvU6n7O+2cvRi0h3AZZKwNRb8Wsg2s/pudEhynwokpW9Lh1sTy 9ozoSkgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0ur-0000000ER30-1cRt; Thu, 10 Oct 2024 21:41:49 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fz-0000000EPA5-3KtP; Thu, 10 Oct 2024 21:26:27 +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=0+l713dFhBMpKSXKC6Fm7N/NzG3LTu7+MrLDSBO7iRI=; b=BFrpG32UpvfG0u3yrjTGXGYLYt ue+yNS7nOPPJhRTVxL9ogUkO7jmZ2YwcRBiwcIEYlrQwJssTbiTSxjqrgjWy21eadLgewhCc1QZgD E4+Cg8UrdOuaHYR1iogEBh2yIOtPlREIlMa6EXL/aw0wHJ0XmqqyQS4KK7B2HSSN1I0IMRiwEmBVB R2W6WK/c4ronhrw38+PYTLkEJ+pPhTEIGtx78O5q9i2xQ/gq3fQMIf+h+hn+VLP2G2L1DmolyiG4x AbeI8A4ragNE23N8byRYqF0CmZzFG4ei1ycPh7t5i4T+r9f+GT6SdoIy5GXcrhBYn1jQDCCiqmJad PPo/R2uA==; Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sz0fw-00000005fg7-1eVs; Thu, 10 Oct 2024 21:26:26 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42cb57f8b41so15127245e9.0; Thu, 10 Oct 2024 14:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595582; x=1729200382; 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=0+l713dFhBMpKSXKC6Fm7N/NzG3LTu7+MrLDSBO7iRI=; b=BTV/YoV+Yj8LirDi5yZ4KW4t0sYCFAKPslcet4KPymGyF6DnBwemTlFEj8EjAbj8Vj L7TmPJ6BfwVJcyAgguaqzdYKj7FpbWnjNLZaY1jXUrdFS3Ycmy2Te7Ou29LgDQEp/dTK ha5YWfJhsVHGuTAvd6VsGdYGCRtDsTjuySje0eBYKTx7++75Gtzs0tlMphYSJ6WwQ2JJ 5qNwLUj5bmEHFdAE87K92o0PoVkdtuPn73ii84kcI1uHWT9gWpA2pEuXts5EpWSxRBlU g6M63acm0cxbwYLsN+yhLttNwagBP/bx78PliAGKl7Fu3zRuOtHMEixuuhlepX8Z2Zul KK0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728595582; x=1729200382; 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=0+l713dFhBMpKSXKC6Fm7N/NzG3LTu7+MrLDSBO7iRI=; b=cnaYu+EbGYK0KaCKifarTNHomKNUAosjptd0/yD/cli7n2db9uGliAv8t6nCbnY9D8 Gu+ES/w/I68UTzlVQkjL4R82qYP1diJN7PDwiXfZlFRBxcIVtJMBhELwdHGeki0CcvnQ PavSVFlV/wnYiCDr9GO8PUKWQSZpC99s0epsqQk10AqX5hEju/zAiXAvzgLt+GzSXabT r79Q80LTUpUJsBCXbJuhrJuTkOSIy/8Lt5IvtxFvMC8NWRLfCJ794Hx6uBfZtAhXes9e ZDrCI1SCNiGE/BBEnIL2XQrdmNzbaRLyF3ZAUPwIVMXKhjWUiIl427N2W6p9Xia+km6U U2/g== X-Forwarded-Encrypted: i=1; AJvYcCUC9Toratg2T62IRzfG+6WANjvlVGokw0bQCZYm7ABbEW0Q3iTo9Ix4Zdsqega2b1PLBeiJ0jAj5w6tHzELWV8=@lists.infradead.org, AJvYcCUOUWCotyJ0qDtJGKdVngkio7Si2S7By2MK3AI7ffwzoSepV8G3yx/88yF5uXDYKHeHH0tTGXsS/DdCFUdCpc4TFg==@lists.infradead.org, AJvYcCVtMC5Do5nvAK26ON+S6nxhU1YzKADHY5ZlGz1+gv/0w6QhHjqQtGpFawmcmeij7ELoupMM/Zz8eH2kc1DYYGkN@lists.infradead.org X-Gm-Message-State: AOJu0YxwN2tJo0PIu1xtX9z6lLUgeaYyGsF2/7SSbKfjFAzaZ91+hnhD kJDk/SxiZhGQP767HppVTpuBVguFk9JaHZ6j8wAdDXCgx65JFPzz X-Google-Smtp-Source: AGHT+IEvJZkGPBj6pO8V1hiWxBTo3gFi3FsJ4y5Lja3Q/V2mIy4xGoBh/d2/6Gut5mAv35qY3Oj9lw== X-Received: by 2002:a05:6000:1a8b:b0:37d:511b:aec1 with SMTP id ffacd0b85a97d-37d552adfacmr460647f8f.45.1728595581715; Thu, 10 Oct 2024 14:26:21 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6a8940sm2402083f8f.6.2024.10.10.14.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 14:26:20 -0700 (PDT) From: Javier Carrasco Date: Thu, 10 Oct 2024 23:26:00 +0200 Subject: [PATCH 10/10] Input: ts4800-ts - use cleanup facility for device_node MIME-Version: 1.0 Message-Id: <20241010-input_automate_of_node_put-v1-10-ebc62138fbf8@gmail.com> References: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> In-Reply-To: <20241010-input_automate_of_node_put-v1-0-ebc62138fbf8@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728595555; l=1226; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=4o2z0ObAz6CPUNa+/NOKjLjAT/4Z8Sf5d/THzPhhJlQ=; b=8IHDkQJt0RQQZ7gzCWiCDhKjk3wcdMT+YxA0O1TzbbCR57WziNB1Lx4QOqe5AQsAbp1tPpiZm 2LS//T4sNttBUuMfU0lGBv8RZk6/sRz5DdGS4tJGsn+V5T2XSOKEf+C X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_222624_641193_EFBC7A0C X-CRM114-Status: GOOD ( 12.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 the '__free(device_node)' macro to automatically free the device node, removing the need for explicit calls to 'of_node_put()' to decrement its refcount. Signed-off-by: Javier Carrasco --- drivers/input/touchscreen/ts4800-ts.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/ts4800-ts.c b/drivers/input/touchscreen/ts4800-ts.c index 6cf66aadc10e..98422d1e80d6 100644 --- a/drivers/input/touchscreen/ts4800-ts.c +++ b/drivers/input/touchscreen/ts4800-ts.c @@ -110,18 +110,17 @@ static int ts4800_parse_dt(struct platform_device *pdev, { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct device_node *syscon_np; u32 reg, bit; int error; - syscon_np = of_parse_phandle(np, "syscon", 0); + struct device_node *syscon_np __free(device_node) = + of_parse_phandle(np, "syscon", 0); if (!syscon_np) { dev_err(dev, "no syscon property\n"); return -ENODEV; } ts->regmap = syscon_node_to_regmap(syscon_np); - of_node_put(syscon_np); if (IS_ERR(ts->regmap)) { dev_err(dev, "cannot get parent's regmap\n"); return PTR_ERR(ts->regmap);