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: 13831180 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 7320BD2444F for ; Thu, 10 Oct 2024 21:28:56 +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=UHuZsOJ9IjiBZ7BJMUIFPBx4wD lpWMUGZDGqY1irJbfE+1BxSd1SpfVgN5KZaD63s3Y8brzjJl//OsWPyblrGmkYgP9wv8DHsoe/ANQ jSOORze6O6a6CLw/CrEshn+wFw4ci0Y1+wGcYPG82DVHjYHElhtP7SwybFCOvcz3UmFXqZKAsFUj3 9iVpeaKRoTUImOxiNtODA9G13r7XZck19vXqKRCklPeNmaXC8D0w108rRK2wpOcC79tJGQpoyjwLw fOGW30Us15bjxD377soPjK8b8PcTUPS9nB3NUQR1LdaVsjxCL+t9gr/F+oR1Hxrq/zv5lVG/apttP Mxra/c3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0iN-0000000EPdN-1zUc; Thu, 10 Oct 2024 21:28:55 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13831306 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 60BCAD2445E for ; Thu, 10 Oct 2024 23:31:43 +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=MJujDoox5SWpX3IgWh6gW0cOuH 70s+5u2959QmdTGm7jJ5Yq0568xUBeS50F+TnHxTPOal2yAGfJ6vGM9mJVUUcbNXg1EFPLH/6IMhZ DL/OCuyvn/QqsMH5X5r2V/X1CPFDwSe2n0uplWvDykjJmmjP4Q8RHEaNSpR7HriCS2zx6B9o7MoXn 0oxEhj5Pgiui53bPbh1LC8iN6MHLN3WnaIpUGVOvAloAB4ldV5dNGbAuZJXo0v1sYajoTE7S9MdoJ /gJG2oQkhoNbPPsXJ2mvygaE3RtkgveRXxeu2qxuW2BwEFMNfDBDlp6PhkDgYQEgCZE/emgqvtiT8 UCQorcsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz2dB-0000000EfDM-0W2o; Thu, 10 Oct 2024 23:31:41 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13831271 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 8C972D2444F for ; Thu, 10 Oct 2024 22:46:28 +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=Y2GmcM7LJCFzWj1N7AQkzfmx7j nrQUYQpo3orxlxUmYhr5supzynyc7TQBiGNwKSXtckMsEm5n+yAlOboqfXEDmGB69PHaE3GtCC1um MmB4TCyIXPHdKDvTvOBN0lGUBg3G696H4gU+n6GmRfKUfxYVSt5gRQLpFuWbjt951MoaO8soKO2qV k4YkeAH28ZsqWyGQ+Bux5zFQRblZOlJjQEMMcqDtJ3PN10KLUqT9rX4yWXv3VFb1HpFmp/MSuQ674 +iRqJE1fMRr2/0eN9ZwfBENlSP+vaZaRuxSPvQ5vQX2geu0d4KOdsGvbpIE4cWWECwxXvpGMCYmlh /8k0btuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz1vQ-0000000Ea5T-0WJN; Thu, 10 Oct 2024 22:46:28 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13831184 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 7BB7ED24456 for ; Thu, 10 Oct 2024 21:34: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=fHWRZlXxWyBjeMmMTHiCSMSAw8Pbb8irSTDpVqQUOvo=; b=TV2M3KJ3QM/wPpVx+FFsi13ZDX +cz8ixkxpZt/nH3SKoLGIf+NJFAKRvinPdMvXw6XWKoJhwO+32WYRx9hcI1zA2q7c99XetlpOfT9R n4AKnwnj58ZIz2kOChGW+HS9egds/KKpIju84Bbw96ZKTdpZzUV1ut1I/eJhEm3a/CSqf/5RZjkZV KqAWcUHkv8eT4Nq6Fvg/m14fbqxvkkQvh4JwOkhbc3YZGTIvPd9kB9RuoTWS2l0M0bfu5OQh+UnU0 FDxA9V6uqdRmYTNuLfwy0eUuBOjA3BRMutoezU/7QXnUDMy/Q4fuUAXtrxjBR40fpER6EqUPQAJSc P+1hCPyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0nu-0000000EQ9Y-26Uw; Thu, 10 Oct 2024 21:34:38 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13831183 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 ADC71D2444F for ; Thu, 10 Oct 2024 21:33:14 +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=PoiyEWsJR6nBooAa0Qm0ssjyBa JtRCwo2bLpPZ+opdIyVxOGFOcOm+1816erjAULbfEF1dVFEZzXxkYjlwt+YC5GZHFhQ8pCW0ZCamc 3vVC2M/63qqOs68nEQgRBtX/p/byNnaglBlfZhRMGog8bAR6FII+SXyjcmtnMnElWLjlnvruIwGiA W8arc1vfwzWWqIAWrPrpCxfxhesnDLUx9CPRVP6tD/hnFlIGnm4xvLkv2S0Cx8muhwER3mGdqUIL6 u4R9f7Whe+ZStpMKRQG4EsZ72tG7jC7y92MIrrBqwdHc0+rhCdaXX3w8z3Xm+d0KkazuDuA5GVywM cnExeQNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0mX-0000000EQ3O-2QWS; Thu, 10 Oct 2024 21:33:13 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13831188 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 05EE9D2444F for ; Thu, 10 Oct 2024 21:36:01 +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=dZg7y7Bk4f5eBX7FjA+ekqsN/R dHPyIgbyVvxNKuPTYdol4VOUpNvw1kdKKb9MONpaSJiDJbLl5UFlei1U1UaJrJzAOwH4KyW52mz9x TRyY/eU4qWvsuMoC3NLrSmINcwCav3NwmU4gSQTGwMiCZyd93CW49wiq87rVpq4zm2Xl0tILxt9w0 XBuNI1HkVukWAc8048L0ir8txv0xBDFIbVlEeTJOJRzgWnV5I0aCrvL6T+cDCYs2EdKiirl3Z5vGw bYRCB/ISZra5wyo3YrdsS0Pfl4aSni+yLVtWx7z7qXSxxtCfcP2NfJyMSObjmz+xg6W8jti7DZuyz j7TM4goA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0pD-0000000EQHC-416q; 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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13831189 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 338EDD2444F for ; Thu, 10 Oct 2024 21:37:32 +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=QvZqMngz2aF/bGJIwGmRftVCS/ l32eOWaEfFLXro1lH55xS9cyck3e5ruNXD14fNZXlNT7cASrR632G3Gck+Zijg9CpPVQDbRDqHhf+ lBe0ymZAjQn0TC1z6PbH8f4Yp8SjsRb0yMeEM7s35Y/3oHXWI6n4sI/INaduyVjxY4mat0bxfFyxH QvZwwuhZKtDuLppjGB7IR1R2NWlQJj+eAXKe7eaQI1av6HArp7b2ER6trrZ/+usHUprcVjrdjYhq9 cpQ1ZXZc+I8HLfliITkv7jZw8zvYSmLQI7bh7zSGln4n+kNLqEvX3Jno7G12NK6cYpQ1VczcuHbUh e9h+kJTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0qh-0000000EQTR-0RuT; Thu, 10 Oct 2024 21:37:31 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13831195 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 6A05CD24454 for ; Thu, 10 Oct 2024 21:40:24 +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=2i6n2OVf3oIZim5XfpZONGda9G aWwbnyKRI9SuMZJEI/MGOwhLjhp+RetWAqMXR2oFh/DMUZAhq9Oi1XiWQbNrMvyIpapqpgo7mp9DI 8O2VCnpdTZgu7QXpcYCeR6Q11oJH5OYhe5OH/lGPcIhHfy8xmy2esZYiNerrikiCIXpOrrGBnmDx1 UqSLFEd3I8quchi1uNERQpKQQjEHy6D6p65K/lSwVSTuSbmEYv9CsCMlxBFiTMgsel1QgpTaRxK2d 7FumodGMHmDQ9QR/4AWMMPvrFCDM4oWasQCP2M0u/ztnPkG3GaH+x14ktkoKEL22tpdO+pu4rFJ9w 2Z35xYlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0tT-0000000EQu6-270G; Thu, 10 Oct 2024 21:40:23 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13831190 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 B7D78D2444F for ; Thu, 10 Oct 2024 21:38: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=zmicnpp9cd9JtqZFSnHyB6Y93ime6LMtu/deyDIKcMk=; b=Mfud4KqtA1sg8EJI6Uq4QV4Tp7 FokZ8wELWT1nFfJQ5NEWRoBk5vVpDrEElnxKzl9GKkuU18Mzt1fhJs/IrRghUp2B7bQO6ILvuxOSw L9f2DflYsWuxedYHBoAI6ZQkEJW9MKNgBJ7So5XT+BgP8NLiDITfQwuD+vQ2OnC7R4ASHFAoK2m5D L6PHsywIWOgw/oG9LivI4rGBdMj0Gx1m6nzMyflMNsP/A3oxtCWtFLBKOOe4upssz7G4g2pQ+wamr WCanfY9gD1vnjzej2SH617pCk/xy/SsrBNqDVAJVTSEuAPcxSDk+PzZhbcg/hlaR21XB8ZwHZn7Rf Ov5n53xA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0s4-0000000EQee-3HkQ; 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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13831196 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 03A0CD2444F for ; Thu, 10 Oct 2024 21:41:51 +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=3SVZ2U7MCoWnRW5BveUX40KU78 7iuyXxhGJK4kNUb9wQIAOxxixtLiVFjDQq1EbSc9MhBxtlrHAtZvhvfocZ/GVnIwF1u/eodSA7arF cHvll0NalZ3M/U32LoPq4aKxcapEHzGMaoI1G1IVFRIIMBYh1Hx3BeOwOIErKailoOSqJOWU443x1 waQyFB3KR11c7pZtG4UoKF7kXAUj/uvLJJuQsFaO5XgQfgsFnC2Yi5NK10f5j5Xg+PhHBFjWPrjhl y8l9PcOEGw18PowJyn5AxYLc3NW2ckycGrPy/kN9F/dsF7RA1QE5RCaUhVdXzprvWRlLP086ToQf6 o4HUUnqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0us-0000000ER3I-050v; Thu, 10 Oct 2024 21:41:50 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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);