alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: intel-sdw-acpi: fix usage of device_get_named_child_node()
@ 2024-04-26 15:27 Pierre-Louis Bossart
  2024-04-29 15:01 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre-Louis Bossart @ 2024-04-26 15:27 UTC (permalink / raw)
  To: linux-sound; +Cc: alsa-devel, tiwai, broonie, Pierre-Louis Bossart

The documentation for device_get_named_child_node() mentions this
important point:

"
The caller is responsible for calling fwnode_handle_put() on the
returned fwnode pointer.
"

Add fwnode_handle_put() to avoid a leaked reference.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/hda/intel-sdw-acpi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c
index 5f60658c6051..d7417a40392b 100644
--- a/sound/hda/intel-sdw-acpi.c
+++ b/sound/hda/intel-sdw-acpi.c
@@ -45,6 +45,8 @@ static bool is_link_enabled(struct fwnode_handle *fw_node, u8 idx)
 				 "intel-quirk-mask",
 				 &quirk_mask);
 
+	fwnode_handle_put(link);
+
 	if (quirk_mask & SDW_INTEL_QUIRK_MASK_BUS_DISABLE)
 		return false;
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: hda: intel-sdw-acpi: fix usage of device_get_named_child_node()
  2024-04-26 15:27 [PATCH] ALSA: hda: intel-sdw-acpi: fix usage of device_get_named_child_node() Pierre-Louis Bossart
@ 2024-04-29 15:01 ` Takashi Iwai
  2024-04-29 15:15   ` Pierre-Louis Bossart
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2024-04-29 15:01 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: linux-sound, alsa-devel, broonie

On Fri, 26 Apr 2024 17:27:31 +0200,
Pierre-Louis Bossart wrote:
> 
> The documentation for device_get_named_child_node() mentions this
> important point:
> 
> "
> The caller is responsible for calling fwnode_handle_put() on the
> returned fwnode pointer.
> "
> 
> Add fwnode_handle_put() to avoid a leaked reference.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Can we have a corresponding Fixes tag?


thanks,

Takashi

> ---
>  sound/hda/intel-sdw-acpi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c
> index 5f60658c6051..d7417a40392b 100644
> --- a/sound/hda/intel-sdw-acpi.c
> +++ b/sound/hda/intel-sdw-acpi.c
> @@ -45,6 +45,8 @@ static bool is_link_enabled(struct fwnode_handle *fw_node, u8 idx)
>  				 "intel-quirk-mask",
>  				 &quirk_mask);
>  
> +	fwnode_handle_put(link);
> +
>  	if (quirk_mask & SDW_INTEL_QUIRK_MASK_BUS_DISABLE)
>  		return false;
>  
> -- 
> 2.40.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: hda: intel-sdw-acpi: fix usage of device_get_named_child_node()
  2024-04-29 15:01 ` Takashi Iwai
@ 2024-04-29 15:15   ` Pierre-Louis Bossart
  2024-04-29 15:32     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre-Louis Bossart @ 2024-04-29 15:15 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-sound, alsa-devel, broonie

Hi Takashi,

>> The documentation for device_get_named_child_node() mentions this
>> important point:
>>
>> "
>> The caller is responsible for calling fwnode_handle_put() on the
>> returned fwnode pointer.
>> "
>>
>> Add fwnode_handle_put() to avoid a leaked reference.
>>
>> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> Can we have a corresponding Fixes tag?

Good question.

The initial code was in

6d2c66695bf3 ("soundwire: intel: transition to 3 steps initialization")

but then moved with

08c2a4bc9f2a ("ALSA: hda: move Intel SoundWire ACPI scan to dedicated
module")

I guess a Fixes tag for the latter is good enough, it's a 2021 commit
and that would probably cover most SoundWire platforms.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: hda: intel-sdw-acpi: fix usage of device_get_named_child_node()
  2024-04-29 15:15   ` Pierre-Louis Bossart
@ 2024-04-29 15:32     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2024-04-29 15:32 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: linux-sound, alsa-devel, broonie

On Mon, 29 Apr 2024 17:15:19 +0200,
Pierre-Louis Bossart wrote:
> 
> Hi Takashi,
> 
> >> The documentation for device_get_named_child_node() mentions this
> >> important point:
> >>
> >> "
> >> The caller is responsible for calling fwnode_handle_put() on the
> >> returned fwnode pointer.
> >> "
> >>
> >> Add fwnode_handle_put() to avoid a leaked reference.
> >>
> >> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > 
> > Can we have a corresponding Fixes tag?
> 
> Good question.
> 
> The initial code was in
> 
> 6d2c66695bf3 ("soundwire: intel: transition to 3 steps initialization")
> 
> but then moved with
> 
> 08c2a4bc9f2a ("ALSA: hda: move Intel SoundWire ACPI scan to dedicated
> module")
> 
> I guess a Fixes tag for the latter is good enough, it's a 2021 commit
> and that would probably cover most SoundWire platforms.

OK, let's take it, then.  Applied now.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-29 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-26 15:27 [PATCH] ALSA: hda: intel-sdw-acpi: fix usage of device_get_named_child_node() Pierre-Louis Bossart
2024-04-29 15:01 ` Takashi Iwai
2024-04-29 15:15   ` Pierre-Louis Bossart
2024-04-29 15:32     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).