ALSA: hda/tas2781: Fix acpi device refcount leak at tas2781_read_acpi()
PATCH 1/2 ALSA: hda/tas2781: Fix acpi device refcount leak at tas2781_read_acpi()
The error path at tas2781_read_acpi() doesn't release the acpi_device adev but releases another device physdev instead. This results in a refcount leak. Fix it by replacing with the right object.
Fixes 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Reported-by Pierre-Louis Bossart <[email protected]>
Signed-off-by Takashi Iwai <[email protected]>
--- sound/pci/hda/tas2781_hda_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/tas2781_hda_i2c.c +1 -1
@@ -118,7 +118,7 @@ static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid) err:dev_err (p->dev,"read acpi error, ret: %d\n" , ret); -put_device (physdev); +acpi_dev_put (adev);return ret; }
Signature · 1 line
2.35.3
PATCH 2/2 ALSA: hda/tas2781: Fix PM refcount unbalance at tas2781_hda_bind()
The error path of tas2781_hda_bind() needs to release PM refcount as well. Modify the code flow to handle properly.
Fixes 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Reported-by Pierre-Louis Bossart <[email protected]>
Signed-off-by Takashi Iwai <[email protected]>
--- sound/pci/hda/tas2781_hda_i2c.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
sound/pci/hda/tas2781_hda_i2c.c +3 -5
@@ -608,15 +608,13 @@ static int tas2781_hda_bind(struct device *dev, struct device *master,strscpy (comps->name,dev_name (dev),sizeof (comps->name)); ret =tascodec_init (tas_priv, codec, tasdev_fw_ready); -if (ret) -return ret; - - comps->playback_hook = tas2781_hda_playback_hook; +if (!ret) + comps->playback_hook = tas2781_hda_playback_hook;pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); -return 0 ; +return ret; } static void tas2781_hda_unbind(struct device *dev,
Signature · 1 line
2.35.3