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: 834782 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04E761E2841; Thu, 10 Oct 2024 21:26:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595563; cv=none; b=Skroe7M3kfbnjrBI6TZX+hxhygofcF73v8YJ5i23sEHhzJk7tk8nzMJ71sCuV3gZxjQwBZNdpA+clXyvZgTz7nFmgmxtcSNKRTXYVKLKfOzYZ07G3rX89graUfB29h9sNwrDtS6/nJh0lI0vJL07KnVji739N5OFL9rBOw9WMhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595563; c=relaxed/simple; bh=t9fa1o1a5Sgyy/pkELwXsraoor0CZUbJK+3ORgewgNE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kJ1pko8TZXtgNiNxCdipun22CUcJgAGfk4g8cyTBBt9KFMybGNl3kVPstqgMYlZpVDkP3bYAWChhZ34ErK5ofoIxoKgqu/iuObUqpNa5UnN+m491X3RJ5WQW0HLP1eEqY70p+3NplLnqJQTjiEsjeHLw9iI1O9horM9kPr9mKcc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aOLqmQMq; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aOLqmQMq" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-43117ed8adbso11821965e9.2; 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=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NP8lfF3+tt2bERQMe+43qAzEv8h11+8hyUY3IsdG9dE=; b=aOLqmQMqdSamYsfthRnWg+yuD0U4OPVRH9TvnSRurf4N+NdL2ZY+oISxez4atTorWO 1qCN4l5DQEHgqK5FObQ6/qb5PtZVfvUO40+IkZRfA1ccvbkzsurBlFwxpmSLOs7TvYYN DNpBTryZLItXnRBeG1hKovD2e554wlowleSMKOkUwrpKu+rgYhya15/2buT08GxN/C+U tK0JRd7KduwyG1QIaSihwm3iKetbw8aNsLlvZnDOcAOy0Hm81FZCTJLeg2ACgDeMkUgp BTc1eWLau/ifXigAWt4Qu+xI6qSpvG+3/6xEU+triXjsRfg6zVuZaSjFfGPELo5SV862 tAWg== 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=f6fNST3+VBM2plj5IhPQ2xBR52sU/ETg3VkHckpzJQ+fGBr7HahMaDK57z9LgWP+7T eofcDZyw4xfDChrR7ClKO7uL5iZYyCvSauL8Yo0MJYRAiqdhWD7jFVCMZZ0/aE3qG93t F5UjHM7zehDoqB7Yzuu4+GNqFxfM8HwCoHNa2ebUcc8Xh73aIa7x9r9PNUusqgS+tiOr Q9x/oissdHV1+pOb9sbMv0HGTEci77gXwXG4bDL5ao1onzJMkOs7doczIofP0IOdOmkc 3X0cB+LcMzHf2iNFazi1SbGAiMJ8PdLAAIiiA5SqTCEOw9NCq6OYPaSEJiwAjH+JDkxY 7p2Q== X-Forwarded-Encrypted: i=1; AJvYcCUg31Zfs+bUXDBhj+6QgZsFzR6hwOxMhmKuFsazwaeNxU1jFQ0+q6JpL4JmBiUdR6Z9HciVbv1GWdKRX+Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yzlx6tL+GB4izT76LL6ZyCmSGnvG23A2NZ4Mug/flKO2XiGOye8 7Q6bJ9DdKJnQfYY833WUsYpKbw43SGDxqRR3Ohfom7dY8TnMYIIW 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 834330 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EB851E2317; Thu, 10 Oct 2024 21:26:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595566; cv=none; b=IxresxcbuDubKB5zgfXCjUR5sZZgGgZRD9hXxRAyfGC8senkub/jZC4MfQOcorRBdFXQzNztqhN0Xvd3kxav+nWD8fCrrIvT9ja7Hie1RZ8Cf846pSyZlJ2JlF9npJAzYBpVxXijSpnlcu18ihCtCY7W4vh4kooJHFWrAk3i698= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595566; c=relaxed/simple; bh=VnsjVhq/mttVM6JYsQsLgW4CuzOsRfVPLIHizOJxOgE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IbOydjSjs36esoMEPqA+T5g+UMc835F7/J7DvkU4FU9dqrHgfMLWS4OISm0f5I9x3fl4ZoT+wRm+jkdigHcM9mJsXRjV9JbmAQcWX4/Wzd+RncLRZpzzQtXIlN4+SKylbZTC7Vrm0eGXdRrsZT8aDXrmKZjqVW2nZSGgUbKaW6M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IWY9iM3H; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IWY9iM3H" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-37d461162b8so850820f8f.1; 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=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=82HiPSULHr+FUteMSvvyK8noRcXFrMRkdAs1zK1bpjI=; b=IWY9iM3HSKIwMavySQMAYzo9M6ihDashvYIeZgkuKx9wQ02OO7kPlvrnCVbtX1QzDy n6Zd3XgPudVws9HRICd23Gibhl1D8FJEC5+JPpCDqNgI4Bptkw9+VbSSYKoWsPQRS2mc apCV9ATzvXxtQZ6g18HUkQEbZ33JIQSKsvLAIX+UCnmB7sPUYOvS/cm419welkeNu60n 0TJRHAzwlkvuMzCzAGJNJ48VR9gt/9FBzOL/dbcLC71OEXhOAgSMRYocnKkE1V0+ozW8 bxJzsu113qMBXDW13BgioLdBjsXp1/wH8SNWYNF3hwzvWwdiYcKCzy/kc5zj6yVM/pVj MTBw== 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=gOgKxObgZ1G+/nlr+st3EXwdql2C7tna2t9jSeskgWT1KXRGErgQwweXsScOfnTqKq XWA8MGsfzSlMJ2KGU1tu0c3EwodNauIHjCaBAzMM9z9p8NC9mupOp7jH6CiGgk8N8PxM NeEUM7xCwY0IKfV2gAnuLhBs24sfYY6lDaVR6kjOfLkFGz4lYx+pqX5KB3HmR0dOTxKU ltU/YwXSlgtrE+gvKPGYdUHb0vTxwWW2Nzsi2addRb6KzUQZ/qfOcY4WARSjtRSLTlse 2etfCWYGz6pkgcx0ZHQxstUFdtOrE2C4dSyEe3Jnosem86HUYlEzd9Zdq3R0XyBHOsmu tWmQ== X-Forwarded-Encrypted: i=1; AJvYcCU6RuO1CUrydlNRXFwlLWOUgRk7U5Q2pN2N3fwC7+aZG406AiuJjJzpgGJfJPIpE1hntTxoD/T3VPGc3mU=@vger.kernel.org X-Gm-Message-State: AOJu0YyA8U3CZt+QiyntJ3ZzJDAVhzwCwiYalQe7T4uixD1Y6DU3qTg5 k1mtlUFx+WgNSYVW4v4kdYIm7PwzjdN3c+c4lTD6qKGXKKw9jsJZ 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 834781 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E93D81E6DD5; Thu, 10 Oct 2024 21:26:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595568; cv=none; b=T3RJTQRgJ3keZ1IsBodaI7acb1iZSzaZG8sRGLz1CRSR9pEdMSk9RF78urLl+TmbrGD1uDC4gGxjC8PeYOSV7ZXkApIOZjC886DA7hhjn9E1Ex219HfDKX78UiO6Ry5O3CtLK9XxBLdtMxQTzDnVe2hca7ofpBRt70hHHvYnGrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595568; c=relaxed/simple; bh=AF25XcLrg1gJJCZ0loQqPaYtp8vI7GzZlTAbicwO06E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YXwSYIWxrJ0sQNWVNSis0rP3o4Hfb5gyU+nHiJgJbJ+96SN7DKyvpFRLT2NTqRdeMYdmzX+rZgBAo9D7QtbVVGtTAxvUmX1xubfyhD48hnpiA7S/YJZ3ddVdQQBFQNbtrJXx7nEXPddF3wt1CM5lc7ukh+yvx5MJd8BT9f1mjR8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Yce9kRrK; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Yce9kRrK" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-37d3e8d923fso806160f8f.0; 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=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=J/PQS/8RbHWMjns+hXbfTHhQVRn54n1C6fHMniju3VI=; b=Yce9kRrKro57Dv1AHTtSNpYQ8ymjJPami85cCi9mI+aT5vdaCQrEGuMqyqEHDP5IHN +7Vk8TWuZMDPVn3vn2W54iGB1nXU17FgF6vkLut+6OAvzu357hwp7Xy6zjyPZNZtzR2h riXQRFAR5UMisfnLooh/QB2kTDRnfrDW7yVXj77SJnOHe5sDkzBRuaqhAy+y0nwDghuo iBNEr0jPKxA5KDbAP4oA0mTVLmAEeeBTQaqvVvDqGtJ3SV73Uq9iHurhCngM0AVtRLUp SIgm5w00xLOAO08a73kB2XCcvn4e3AZTb05+yEuX/KS0H5Vp8Tf4ucp2morbVGJEDWGb MsMg== 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=SDbkdL/IennGbReuI+WDAJ72tfv2nLCc7smspfTQl4LWQqUHNWiQb4Adx3Pl8meYHY Uzk9UNQFBd00ZzwpgDqD8bFpOQhnT1SOqrsL8RRMuoKd+d0UGj/faH9WKenJY+U8pEBG GMsA3ZP5/RYpiLIHaNspBggSEFsEIVrUg3LMULvr1M4SSI2+X+pRSVaU7D+hfEw2IaH8 jSivSZb3Tyzk/g1EyNqKlafRiT8YHegS/B4hfPi2eRtI1aVeA1jujTgbZZyJyskpCl2x KlUczVfKbjwo+Paaco7CEZUVcnVvh4r762oN4MD4x0UvuEKrm49jeBl/Dv/UzKHOuO85 8rrw== X-Forwarded-Encrypted: i=1; AJvYcCUGIz0uuqr7V/YR2/WxSWNGzoFL2Ck+nPyKziNghKjtfaYnNmhdpIN0vADdjJ4LgKSh4TWOCj5sO1TGnUw=@vger.kernel.org X-Gm-Message-State: AOJu0YxZyZ+v1a6qBuchwQ/EnDxNKugP8kRDbY7DwSHv/jmjfqMke2vn QWXz9bG6xbJzNSayI4yJ6emq+EZwD/lzR5l6p3sNWd4p6wiroD6C 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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/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: 834329 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4670B1E7C2A; Thu, 10 Oct 2024 21:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595570; cv=none; b=Lu0rDAV7AwLkCZUDxsBOnRl5BhNfntel5pX195IwXEvgmVQ4gZdd2uHgLbY5brGk1M75CfRu2nhS17foSyFF8qE6HvdIy7n1MkEgL7JK9Ftc9AH6eCovmHMSs1HHziknC7vZkKwMlRo2IV7Rdg6++4vOFZa3AjBIL0VKmKrS0ZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595570; c=relaxed/simple; bh=tDYGmTbXvdvpbRFG0IrCSIV47mvFQRYsGGj+NcIIddk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RdSDbhK2368Cy/SLOSIbn8PVCdQuj/Z9wkHJLqrFhniWPP5m/B1PmQdY/nG3FBZZZ1ufkyCT+VbBoKrSlItyWw+ktA7EBxjcysd39PRgDGabwNDSK+n/mWkT2BlPloJgBd7b8egKwdj1CXIdSO8brLSZM2w41YZJhiINXd/u+8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SZSjMsam; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SZSjMsam" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-37cea34cb57so827778f8f.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=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fHWRZlXxWyBjeMmMTHiCSMSAw8Pbb8irSTDpVqQUOvo=; b=SZSjMsamZn6r4xDPOWm+S+a1mZ9HNPqPLFNJqZvUwqRBG0jsztXblEeWzqqF8hXrcW rCs0EUiON82K6QlRgCdjnfWQ/LNmxVbMnxQgFVwqQWRS32Iacst5XiQRFKMn2vKGwa2Q sAKMl2oucMot3qzdrw6nEvHcIpev7XS5SFZt1saTbBLJQfSTLTdRTIZJsDFpm1KU0lGi iW+AF54lARmNlvl/LMqyjkDYkNxgqEZKNomJ5SyzANgf43pnmfixdR9RRyR3m7Egd5P2 KI2cM3hiKQOp57szLvbR3YO1ikwp3Xah0ZfS7qVP+CFWZZyH2iFOkcJv83IP/ACQBnt9 i7KA== 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=avTNgZN3a8gT1XVpjE2bIgfTuhOa4j0/1DAVzh8ELVB3UWLiRgMjDmpGa3fvmDDsW7 Z/p9XW1njKZQNmK8dfxiwzsNO3FaQso2IW6JPJ4Z8m31UXMmHiDamAz4UgQgLmT5K5BZ YSGECS6YHgjqKBxFuAlcXAZ4lSe4zrQT2lM7QC1ECg8YyCwiJu5aFtHlbDdaIhO4RQPx Wqy5OGVSSsrq2abxKS0mea6zzcOg5BkYU8y3pUvbQUsGGONA6oLFoD+ImcsPxiww6zQE WORqYMDoGH/9a4HF8tlJEB83WYyur4wyMVimIM21mQLJS2ycIO+gkjrWeb/4ntGNB8hO fL0g== X-Forwarded-Encrypted: i=1; AJvYcCUSiYTI6WsKNiS8n7jwMRgz/W6Mdxf2XeaJXHt1anFDoYimTxKClD5Jn+pX39BK9d9GRGJzA2Z5HHprM60=@vger.kernel.org X-Gm-Message-State: AOJu0YwNkUOUQH5Kh2xv2HPWOKDpkiK0g+XS+5Aq1UR2t53eaaiOKM09 TyF3cXh1MZCrSeaiAarRbWYpLZWAarqsfinL4xxubg/60EqUVhT2 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 834780 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25A4F1E8856; Thu, 10 Oct 2024 21:26:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595573; cv=none; b=OqPAdxJDg2t+X/Fsex23wZUeTBnphN4sMuShsjS7peEhyvJCa0OxdWlJ+J042YwHeD0Ti5bCyA6ssY9h5Kh9XFRl8Y8LqF+o0IxlKUzJkO7yNjDxCQCWmWywae/eVUok5eEMvTiND0BDFp0YwHQcXIdcptx7MSLjhzIRQlR/Y/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595573; c=relaxed/simple; bh=8XjuIi1Czg4gxADzAUScoPXbznvngqAftxkGhXUC4pg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Gybezu8c3SPn1EJZzJk9dSW2FJ5WIX8oF0YTAsE+yXw0HZ5/rheum4XV7CXImrBIzhOipgFhG0fFAr9jm2Paic1QCyzZruqFxqd7Y8r4pCSCo/DSrlZLyqGYb0r9UaVPvrs5Loe+kot30sYBOYZ6HhSwu/Az9bSPKW9WO/+Z5fU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ho1o/gVp; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ho1o/gVp" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-37d55f0cf85so80167f8f.3; 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=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Gv2lnH1bFL+wtFjxRgBI14o1ODjTXUiEC0mw6OfkCr4=; b=ho1o/gVpVAVeAmdzSqP/1IgjvUSFM0UosYW6nhG7Yvlau2nZoR2k5KNYh16dT8Up+b gRdFAIHGetjcMxFeIDYyDN1aAAR/q2RWXKX3SPy/s4m8oIOm45KO4N0rT3gmpbb3p4Lu zW+SZmUf/PrutOCyCjGyMzsGqdHcNsc1lBeGqzpcHnhM9ONQfcTSTBLd6GVVNYL1xgnN 0brG60PwfzW3dH6UjuEhLGn04lksDhDuBSTTiOkEY06jb+bpKZVIaUbAdnGnBXun5stY o2V6Ai9i5nohEKW5zmdEO6mcZx6C0Ow/TcbwM1Hn15bGDzvGMVnRBEYpg7xTSEavoE3V orpQ== 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=al4hw+/NpDjYhjp8I3I2VZ58oF4oNfBZl2wYGtUC7rAMjEn6sBeoL3N8JNNM9vVw1K 2ajJdywrFxqD8PXwCAkSAFC2r4zJ8h13StsjczZj0LV9SOtJsH4i0GyDwI+8reYZJLrk 4A6KrcieSQImDqHDUFk7N1kDSp+xMpega4oCaSl5bLkCfvegjUQyr6PmfiLo3lHHzkWo Aj6AIVjH1Isl6ZpcsgXGDd4t70fV+pLcXxNeOPgic4msU8lci0LTDuLMzJPWIKkIwf+6 gZ4W5gQweGCn83oIw4R2Oh9/PxBQOvbZQJ4uVtgve9rEm/dHFYsB4j8wlH0sxNsq514W XjWQ== X-Forwarded-Encrypted: i=1; AJvYcCV9Rc8fm3vm8ACF46CDVsBh3eARxrHcrhdrpR9NbswMPzs9PXY9DILtCZXRn7S5vPKJQ8xFvG3iqoY3x7I=@vger.kernel.org X-Gm-Message-State: AOJu0YzGvZuDXrQ47VI8HYt6TNFkH11vyr0lu9ffE2vaxNS+8+X1sKkY 962C+HwCGuhGo8cmDGaTZXzG2+4JYNpn8AoM4xwuqOCtuMMIN61R 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 834328 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 289881E9078; Thu, 10 Oct 2024 21:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595575; cv=none; b=bSZakDUlyZbOeU06O8bUPpvRa77PLeMKuu3WN2X+YsZ/EYqfib7ZX/VVfQDNXr+fQvyLb6iGV3m9voTGRQmE5mkHQ9G6a82PKxSw84gGJ9osRGJNy5tinLPjMJFsxIwegS36FIZ1RNsPS8JWiyCqwxHXQgDNb0Y1av3gyCsWSIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595575; c=relaxed/simple; bh=f+TcIDFO1FofKlmr06Cec6JytdWs70QlHA84jUACDyU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IthPCZ92avphI/UCo12R8611bUaVXBbUVPzTxFnmjyYOZnA7Ie6IX4u5Ya4nhE0zMXoVRnGFmnDV3KdpHv2T75Vr4B9PRYVjWUHw7tQGHSO4wx028fmmJ9hzDsHogbDmolwo3TT5rHhWvkrri1XHYDe+nU4Iq9ZE/FLuL6VP2zE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O3jcUC0I; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O3jcUC0I" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-37d5689eea8so9270f8f.1; 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=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=T6P7FJOWA2mY2iTIPWe/1vsKU4sSdy22YB05qi0Ew68=; b=O3jcUC0IcZhcbyMO/Q8s7zP6k0QPB+8pnKo/TIm/ZkjrqXn75dL8JTeCKgHWNjlGDs 4oNOFwujoVPtWjKoGNuzINIcmpwoDYY3GfDRjQflWpa8bBbX+gTNESQiouikIXLa4Piq s2+MhuEYdTSt6N1Lmk7wYvkXL/+vzE1LMnQamtioWFDt9wgCMUlpg6sD0S35f6tHL3o8 b7UfWvUXG8kJR9rh8QRgp7r88it8Dbv89T11uJt2W+PmLCrvScGNzQ5EWM7JGlbqeUQ7 WtYmB7EenwQ617OKaLDg6egaETfpavg+uDVfDe/YK/rU6sM0S6iesOO2UPUMQwobqrJ+ h+LQ== 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=hVKZxe5p5+C2DeUxA7+ORnBdB8Lhu8F18V+wZStZmYdbgJoj+IHlrgByqSgVehjN71 ormrS9CwiSQMmzu+o7Y4CSg+CSEa9MTWUep5UC73ychtV28Tlm1PSZ5d4Q+hn19nLyBX blc3sPXmf5qSAHt0ykKscyt9KslA6WwPIuMI023YwHaW5NTKliplOk6Dyf8bv/o19wYv 5Qfdlkt8OZFMjpBOm9H738DShvByQoSBZHshVw1s6QJiGI+RDnu8Ub5VbS+6xN6lJ+hH q17mEES6ctiXy6LjdvhVJNBJy/U7abuKl++Zz8cpPHGC5uVlI9g1SkhYrDifCTNIOl3m Cz6g== X-Forwarded-Encrypted: i=1; AJvYcCWuepqXZCKvn1HL6CCtulWoEJVDQ7d2EtxfA5VrDkXephLdxUZ62KJ8Bgt4vzIppykfZBqZFy15p/c40RE=@vger.kernel.org X-Gm-Message-State: AOJu0YxmQ8RU6ZI9L7sa1EzDWGty55a6MPkqV3bvpSTzOmzRsZ04MAj1 eM3d8T66rUhiPCpniPnFx6m22WHTDGEl6uoPfGvzdafU5YHz9PJJ 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 834779 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73C111EABA9; Thu, 10 Oct 2024 21:26:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595578; cv=none; b=qKabPUce5dF0j0eu8+J99AZGoyqj3q9s6hIl8sJlIogFOAxnAgDVELShHfP2NNF8Jabc4TpK5DiudptfajCwNBubzXNjUDmBzBJC4eHUEDzjYV7J3H7Qcr6pOBDPYBujsp72O3kYbwBNjlxmio48zATt3FbCyiNKnGxbczuaJNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595578; c=relaxed/simple; bh=TCHsuzKnwrSzC8ELBgoH5r2aJODW1HU03jHewVR1CdI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mJE4VLJkVE2shWEhxH6xu/ACaFMHJNALxkoio9a6T0nufPQWEUj631NGjyx7uAadbXoIz29g7plACEz5BvkD21iB/KqwbAzUgdr9aaYwh5MscsJh/QMX2SsRFNye4JC1Vp4mkcrtOGGsQlpJOXuZoyDK+v8S2c9E4RlH+F1O+vE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=F/fPJPBg; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F/fPJPBg" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-37d4ec26709so591915f8f.0; Thu, 10 Oct 2024 14:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728595575; x=1729200375; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vDpMMaqPXUoFVzi9A3PDhKb1T42MjqvUb4kdLnoWycw=; b=F/fPJPBgaHjtRnE9RIb+Ni5D4E9jKNSBqh69KXYhXEcI5zJYOj3RNq+dxRbCOIxjnN WcJjWcI+BLgPWb/ZkM9QojGFvGvVUGFoY6UcMOd389GIqDcgBDfTH2U0PZrLCXt8wcL3 s4eZy/qMwCwkFxAd17dfsEyqX4Ns3AIAN03zAjppxBLYTZ58RWb1OmRG6jrue7KJe9cV LjvV96FgiIy5iv/QB5wxDIhEY8I1/azQdU8KBFjWE9qt/KFE1kZaxUGjadoXTUe/R06G oUFvftou4cJU9imh44djc/FYkQUM2ZsJk4bo+w2XJwHNwOHMRyozKWYNn5rCWzkcQ9lW MpbA== 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=FynAEudn4Hq7leGfrkMcMSJRlz/FBZRZkLRZ/e+yrYTKJzkxJETMpX+oTwFBK7S0w9 soi5nC3KDToaJGh74UxJUOVOATAA0IlpW+8HmiCOFapKyScYhwGZBEOfx9jCXBF6cj2I CwGQ58OFCksI2SbvH/MEczrknt7i//DXmQPDcOd/qgkdoJi7UAEMi6nITS+7liVw1XQO Mn6Ux/h+kgK7OBxnjLWMAoLwa/QlqCOnpHaJkfEG+S6u5QrvOCG3Cpveoaml3s7/F5+F 10ezRWlkFYPLSzrB7g6cNnvB1BVcqpYjy02v1PXJBT5AluPKP7L5gavgKN2Mygj92zQU Vbbw== X-Forwarded-Encrypted: i=1; AJvYcCWJlslQYOzD/lvWCS7dzyIy/Xvm8C8/kJkbvZZgF9bsj7EYNstlJC63vRvuzKhUIGozP5VJG/qwaOmRyYk=@vger.kernel.org X-Gm-Message-State: AOJu0YyBo5/McZQEaB3lL3F0N0yh6vmjOWZAJnyGBSDGHpc0jhnDjz7e m1S5vbbssuUeqZx7l91+2nU1Oj6y/PpO0tn+xeB8j4L9v6wpy51j 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 834327 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB90C1EABDE; Thu, 10 Oct 2024 21:26:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595580; cv=none; b=L+oSJrGz3VURsu1oeCFE08CSnQ3qgIyYHJtFHLCJsvgLUSoIR5ghxpe0K9XCOYWoDxP4gpqVkMbSZ6i9oPmvgJCAhGrR8t8QZhl23KMQl/EHwzGlzOVpuQY/Rv0QSgp10jjz5zxOg9lXZyvEQuCwDxEESTbjmAHUWU4eGBbLR2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595580; c=relaxed/simple; bh=osj1On2Z4WQ2i4hQXIWGqEGjGF6nBC2nMsxNyB0VvTE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ldNowmxAqpYNmB9mE+PQBq0h/x0y7TvHiVSyYuJsC821HRffc3hun/GZ6S3mv8C8gn58hDq0Nkp+Pl3BpJspsf2BAk31F8CQSc5ykI0+lO19yqIVpMsFnT4fhY0ghl9SZJ4QypMQCdW1dW4DjT5yHTJN5XBVsKuxjCdH8myC8ew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CwTKEWDy; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CwTKEWDy" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43117917eb9so9971975e9.0; 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=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fUDTsje5EfzdoMuNeif+3YwfWRAgSWK+tp+b+is46Rk=; b=CwTKEWDyEEEMV2HU7Ao5oJC2ZffO/M1vex5qrUQztVsHRz2KYPPD5j+eE+6LKEfZdJ mGOV7mzr2jL6PwvQSHaoR4oobLKa2SQRsCzQiabLigy/7Y/n7nP5ovn/LENGpD1GiRqJ hRl1mzRJyDjl2hRFZdP55qZeiO7VSy0jjeM2TyOH48zbzi0YgIA1uacCUT9snzLYlfYH HWgPzWfQhbsn0sld3wbjJS0KYFdEMhNE2HI0FpBDDDnesUu9MTo9Cr/WIF713uAsWz6g gUNq0+g1Nwujvu+Me94FNX6LKSzyptDSc2US/HV89/w/t+/cpqr8QYDwChcrNYJxy2qL Ef9g== 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=FVqZRqJgDiMdtNzpHqYq88uAhUkj/5ta0IWMwJ0ml9xXNGVYhPbQaiIFldxGyT820W 0vYOlrCnAkP8n2SS9d6reKGoev/smy8pbHVaB4umfov/VqhLCVZ1U/Q8pLa0JNylS7ug 805OAF9cr0kO6fC9rmgqoz5t5hL3VWJ0X3UtBwdLrQXWhnpOs6qy3tf0QvVYigs5Ucyb WBuEnxlmcorys7+awhOS2UeXPd7D3ecIIwKW5G3GufyEaHaoOFp5f+hRE8k1Tc6soKEa 4o16yG0HKJWlNnaArxxWh2oP9c9NniB/o0wCIEqUNytt8lgn3zo4bMyM8UCxfjjoa2wt 7aRw== X-Forwarded-Encrypted: i=1; AJvYcCUCCJxDxEoFsdrQb2vzrmV2l/JBCDLNkB+ADEDlM7XW9e3gAWQLvBU5ILXmXq77aJOe3NflxK4B6uoT3v4=@vger.kernel.org X-Gm-Message-State: AOJu0YyR7dlAkAb2bWmN4YB++7RnGg6UlaMkGdOAgbdwzC6vMu1D/GY7 oZB3EgvOPbqlR0tAkl0sRQHAJHnTMJvJBAFIIEOhPtApydZUc2cC 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 834778 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 127571E47BB; Thu, 10 Oct 2024 21:26:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595582; cv=none; b=FmvbMFw2EeE0ussao/RxF4RcudSfa0p6DmA7Z5kDEXwGEHtqrJxDvK6V87Qwrs8ZHDpzk3f8CAZvOuGW9if84/Fvumr7XZ0lj+iFMqwwB/P9Se1xyDqtiLoFm7AcssTxVk34DDexoglScPFIYJXvfSH4Ktxi0THagWeQbYlcTv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595582; c=relaxed/simple; bh=qaHmN1vj3OJMngtAh5LlltSL6miuty/pRQh556o6ku0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V7YuRB32qsmwptWrcDVlI/4hizr+PiW8vWtTYJePfXdepYSVDSGpW+H9TOSHxhbqYElamuTvezgZxB96XxxHvij4UAU3O0axnzsGvaa2ZYghMAOG6HqJHfpEEiOU9rpJk3nPcMIaAmpzuhfoQe1S9gxI3w6RcnQdEmLveBQadr4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iCD9zTj8; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iCD9zTj8" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-37ce9644daaso884664f8f.3; 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=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zmicnpp9cd9JtqZFSnHyB6Y93ime6LMtu/deyDIKcMk=; b=iCD9zTj8aR87YnTpTXaqLQYAtjcsGN9NIlBG4jSVR6O3AiPu0XXNOOmMHJbejMHsG3 TMVCca9KU2PJOragwrXVdbCmLAOrlI863645c7Pb6G1OAxnqxPUEdptcnISitsUWtsq0 HCba+4tT4+16BHzgbgMzKzV52z1E6Nc8/FwpWxF60pMSt/uXyM9Qw0LV5lUcD7KjjJu4 TBUxfVOGYGBD2QjGHB7blc+h5Rg3i64BqkT9c1VSbJb1YanvxLLroCNBWEk66InXUGHm 0U9omlknRR/Y8XX0mN6QFzx5rjS7fxmFqx25yfwpF+VKuI+9OP+AcRQJaijWCmy+0GcV bEvA== 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=Gyc+Er3kgAYOA0jUPvDxblIX/HMcfULJcvbCeX3jonODJ+NlZhj0tA0PFXxvuV94qJ eXPGUBy3Jypg74mNoNQnT24W/m6YmOMjNhgrmaM2jH92cOytFAb/6Jc1guYPZJvtXmH1 7HSr5cBQAtc0bOKVoTGUK47lbtlXWsc5M/wcJlgHwhP5quTVRTd6bdvCgFutKpPY61uC 4ZZA8FcDuB45YK90lIg/bGQL1DYJylRiJnmeZfNteXMZS/OZWvt67dMi76YW4K0m31M/ +lWyQr12aQ5cZ+nrm5RSpFiJ/VOKJIX3+af6p82T1cyqPFK8DRnevcDAH0Su1NL6Df3H z0Cg== X-Forwarded-Encrypted: i=1; AJvYcCUgtS8CChT3BfOSMV+zKu+o66JJnJRfD/kqqdAOxlPrCHV6omUM4MMer09S1KCobj/hM1yEP4dHcomrJr0=@vger.kernel.org X-Gm-Message-State: AOJu0Yxal/nfph9Dj7CCBTTf4UvDSEY307FmZUaIlIDGzf7doFSkTqDI GERVP4ANvjcFp3dRycS/atsSp8FyHEXJuKbQmYGifFEbsRXYDvyA 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 834326 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AA801EBFFC; Thu, 10 Oct 2024 21:26:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595584; cv=none; b=DmFZnWObqmE2JSF3OvgiPIaAcDcdF2Q+lJ6Hiljthc7pn5eMSVqGfzDTzO3Q/WSqE414iBPUOZ2ir8PILDzghptVvtHqTOl81/7VoJKkPWYsvQVG1fU69F4jI9LXh5WTdUHp8yvTAWM/CB48MktF5HFmS2a9QugND4O5y/4m6Jo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728595584; c=relaxed/simple; bh=4o2z0ObAz6CPUNa+/NOKjLjAT/4Z8Sf5d/THzPhhJlQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u0ocQTSzuCUQHfJHj2L5qRdA5+0igEI0HsPt0xP2cT46mC15CtfR3mlGb9xHTUeeVkQZ7TuIvkXW19eIOCNQuYTdTNF0N/cN+hgmVNgC0gNrdOQ+0/Su4BL3HWwl3ANb1jHiiBYwo9zWZaUH6lzrTd8Ghxbvgq8e3Rgs0pGMaZ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OpdRHmy5; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OpdRHmy5" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-37d4ac91d97so940252f8f.2; 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=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0+l713dFhBMpKSXKC6Fm7N/NzG3LTu7+MrLDSBO7iRI=; b=OpdRHmy5xmk3AxG++h4tuYt7KM5dRDWy9PSYglr6GfBvfE+YKk1JGcWIpKJZvefLFD /7GlhwvYaXash26WBbkmCCL2+moORTx4gD4fj6BqD8vueU7XRga4Qs37QTnhcqXYTWaU cPbA5ZG5YS5j0qwNC+78tCoSd6ThnPTpkkBld1gLnExhpgd8tkWc0jRBz1+UWTxJ+r9+ eQ0F9rbZlRIr2Y+ykC5H+9vJ1yhFViLhbmo5ibleSOsmmS2nW7/p29zJ0393RXFKPlXO YrRB7ixxslXbWZhfGh0SUkI52Wy22PVwd3wuN2H+a8J+ynGwRcggOZq9SrOgNVqQ3lvg 71lA== 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=LMSQz2ErAjDkO/UbEKQ2HdGQuaIaJOJts1Y3mJPrO+UQ4RheD/R1zzBnxvkUFdrwvF zn+EqY9hoZ8KESajdpKwhWJAau5GdDqI+e59XD8I0IG4rUF5Zfn9jFtTTNK0w5J4TDyS u0SWIdVTPLuGNLTF1WEzNHUtvrP6pERUyasJTwXLRKqyYy3K5LhrNi80OWPkX0cN/bSA CefvRBxY65IEs8REILEEaoM2dmA+4XhxX2GSlukW/r2o3SKmd57ToMfGSQSG5LTumffH EARMJ8kWKcGknM3wogxWAl/Q1trhSt9iDSmYAesIR1qW2WaVGmRK+/vilRr7e2sjB31R Ribw== X-Forwarded-Encrypted: i=1; AJvYcCUmn8b7LTM2t5S6F1CHgBCL5mqzW1TI3ASs8DPeu1KDePppNvGO79KqqLU85sYNqEu0vmeo4/Xe9IlBCEA=@vger.kernel.org X-Gm-Message-State: AOJu0YwQg0PsDLfIeGgUws7PUH/sw9KJ2aXuYhswHVjaDJuZWiPGaSW/ 4h1Cd8zG8R0zy8zAgUUMZHEDyl1b21pqDFppBKGMkIKHzcREvH4k 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 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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);