mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Javier Carrasco <javier.carrasco.cruz@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-usb@vger.kernel.org
Subject: [PATCH AUTOSEL 6.11 14/21] usb: typec: use cleanup facility for 'altmodes_node'
Date: Mon,  4 Nov 2024 05:49:50 -0500	[thread overview]
Message-ID: <20241104105048.96444-14-sashal@kernel.org> (raw)
In-Reply-To: <20241104105048.96444-1-sashal@kernel.org>

From: Javier Carrasco <javier.carrasco.cruz@gmail.com>

[ Upstream commit 1ab0b9ae587373f9f800b6fda01b8faf02b3530b ]

Use the __free() macro for 'altmodes_node' to automatically release the
node when it goes out of scope, removing the need for explicit calls to
fwnode_handle_put().

Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20241021-typec-class-fwnode_handle_put-v2-2-3281225d3d27@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/typec/class.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index d61b4c74648df..58f40156de562 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -2293,7 +2293,7 @@ void typec_port_register_altmodes(struct typec_port *port,
 	const struct typec_altmode_ops *ops, void *drvdata,
 	struct typec_altmode **altmodes, size_t n)
 {
-	struct fwnode_handle *altmodes_node, *child;
+	struct fwnode_handle *child;
 	struct typec_altmode_desc desc;
 	struct typec_altmode *alt;
 	size_t index = 0;
@@ -2301,7 +2301,9 @@ void typec_port_register_altmodes(struct typec_port *port,
 	u32 vdo;
 	int ret;
 
-	altmodes_node = device_get_named_child_node(&port->dev, "altmodes");
+	struct fwnode_handle *altmodes_node  __free(fwnode_handle) =
+		device_get_named_child_node(&port->dev, "altmodes");
+
 	if (!altmodes_node)
 		return; /* No altmodes specified */
 
-- 
2.43.0


  parent reply	other threads:[~2024-11-04 10:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 10:49 [PATCH AUTOSEL 6.11 01/21] wifi: mac80211: Fix setting txpower with emulate_chanctx Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 02/21] wifi: cfg80211: Add wiphy_delayed_work_pending() Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 03/21] wifi: mac80211: Convert color collision detection to wiphy work Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 04/21] wifi: radiotap: Avoid -Wflex-array-member-not-at-end warnings Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 05/21] spi: stm32: fix missing device mode capability in stm32mp25 Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 06/21] ASoC: codecs: rt5640: Always disable IRQs from rt5640_cancel_work() Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 07/21] ASoC: Intel: bytcr_rt5640: Add support for non ACPI instantiated codec Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 08/21] ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 09/21] ASoC: Intel: sst: Support LPE0F28 ACPI HID Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 10/21] wifi: iwlwifi: mvm: Use the sync timepoint API in suspend Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 11/21] wifi: iwlwifi: mvm: SAR table alignment Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 12/21] mac80211: fix user-power when emulating chanctx Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 13/21] usb: add support for new USB device ID 0x17EF:0x3098 for the r8152 driver Sasha Levin
2024-11-04 10:49 ` Sasha Levin [this message]
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 15/21] selftests/watchdog-test: Fix system accidentally reset after watchdog-test Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 16/21] ALSA: hda/realtek: Add subwoofer quirk for Infinix ZERO BOOK 13 Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 17/21] ASoC: codecs: wcd937x: add missing LO Switch control Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 18/21] ASoC: codecs: wcd937x: relax the AUX PDM watchdog Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 19/21] x86/amd_nb: Fix compile-testing without CONFIG_AMD_NB Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 20/21] bpf: fix filed access without lock Sasha Levin
2024-11-04 10:49 ` [PATCH AUTOSEL 6.11 21/21] net: usb: qmi_wwan: add Quectel RG650V Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241104105048.96444-14-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®