Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: codecs: pm4125: clean up bind() device reference handling

A recent change fixed a couple of device leaks on component bind failure
and on unbind but did so in a confusing way by adding misleading
initialisations at bind() and bogus NULL checks at unbind().

Cc: Ma Ke <make24@iscas.ac.cn>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20251219142412.19043-1-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Johan Hovold and committed by
Mark Brown
97af5447 a0c8ee09

+2 -9
+2 -9
sound/soc/codecs/pm4125.c
··· 1505 1505 struct device_link *devlink; 1506 1506 int ret; 1507 1507 1508 - /* Initialize device pointers to NULL for safe cleanup */ 1509 - pm4125->rxdev = NULL; 1510 - pm4125->txdev = NULL; 1511 - 1512 1508 /* Give the soundwire subdevices some more time to settle */ 1513 1509 usleep_range(15000, 15010); 1514 1510 ··· 1620 1624 device_link_remove(dev, pm4125->rxdev); 1621 1625 device_link_remove(pm4125->rxdev, pm4125->txdev); 1622 1626 1623 - /* Release device references acquired in bind */ 1624 - if (pm4125->txdev) 1625 - put_device(pm4125->txdev); 1626 - if (pm4125->rxdev) 1627 - put_device(pm4125->rxdev); 1627 + put_device(pm4125->txdev); 1628 + put_device(pm4125->rxdev); 1628 1629 1629 1630 component_unbind_all(dev, pm4125); 1630 1631 }