FAILED: patch "[PATCH] ASoC: codecs: wcd9335: Fix SLIM interface device leak in wcd9335_slim_status()" failed to apply to 6.1-stable tree
Subsystems (4)
Sasha Levin
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 082723fee626532f176727b6438b666a96d5246c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 082723fee626532f176727b6438b666a96d5246c Mon Sep 17 00:00:00 2001
From: Wentao Liang <[email protected]>
Date: Thu, 17 Sep 2026 16:48:53 +0000
Subject: [PATCH] ASoC: codecs: wcd9335: Fix SLIM interface device leak in
wcd9335_slim_status()
of_slim_get_device() returns a device with an elevated reference count, and wcd->slim_ifc_dev is intentionally kept for the codec lifetime on success. However, all the failure paths of wcd9335_slim_status() return without dropping that reference, leaking the SLIM interface device whenever the register maps cannot be created or the codec fails to come up.
Put the device on each of those error paths.
--- sound/soc/codecs/wcd9335.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
sound/soc/codecs/wcd9335.c +10 -3
@@ -5135,25 +5135,32 @@ static int wcd9335_slim_status(struct slim_device *sdev,slim_get_logical_addr (wcd->slim_ifc_dev); wcd->regmap =regmap_init_slimbus (sdev, &wcd9335_regmap_config); -if (IS_ERR (wcd->regmap)) +if (IS_ERR (wcd->regmap)) { +put_device (&wcd->slim_ifc_dev->dev);return dev_err_probe (dev,PTR_ERR (wcd->regmap),"Failed to allocate slim register map\n" ); + } wcd->if_regmap =regmap_init_slimbus (wcd->slim_ifc_dev, &wcd9335_ifc_regmap_config); -if (IS_ERR (wcd->if_regmap)) +if (IS_ERR (wcd->if_regmap)) { +put_device (&wcd->slim_ifc_dev->dev);return dev_err_probe (dev,PTR_ERR (wcd->if_regmap),"Failed to allocate ifc register map\n" ); + } ret =wcd9335_bring_up (wcd);if (ret) {dev_err (dev,"Failed to bringup WCD9335\n" ); +put_device (&wcd->slim_ifc_dev->dev);return ret; } ret =wcd9335_irq_init (wcd); -if (ret) +if (ret) { +put_device (&wcd->slim_ifc_dev->dev);return ret; + }wcd9335_probe (wcd);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/2 ASoC: codecs: wcd9335: Simplify with dev_err_probe
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 67380533d450000699848e292d20ec18d0321f0e ]
Code can be a bit simpler with dev_err_probe().
Stable-dep-of: 082723fee626 ("ASoC: codecs: wcd9335: Fix SLIM interface device leak in wcd9335_slim_status()")
--- sound/soc/codecs/wcd9335.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-)
sound/soc/codecs/wcd9335.c +11 -16
@@ -5118,20 +5118,17 @@ static int wcd9335_irq_init(struct wcd9335_codec *wcd)* INTR2 is a subset of first interrupt sources MAD, VBAT, and SVA */ wcd->intr1 =of_irq_get_byname (wcd->dev->of_node,"intr1" ); -if (wcd->intr1 <0 ) { -if (wcd->intr1 != -EPROBE_DEFER ) -dev_err (wcd->dev,"Unable to configure IRQ\n" ); - -return wcd->intr1; - } +if (wcd->intr1 <0 ) +return dev_err_probe (wcd->dev, wcd->intr1, +"Unable to configure IRQ\n" ); ret =devm_regmap_add_irq_chip (wcd->dev, wcd->regmap, wcd->intr1,IRQF_TRIGGER_HIGH ,0 , &wcd9335_regmap_irq1_chip, &wcd->irq_data);if (ret) -dev_err (wcd->dev,"Failed to register IRQ chip: %d\n" , ret); +return dev_err_probe (wcd->dev, ret,"Failed to register IRQ chip\n" ); -return ret; +return 0 ; }static int wcd9335_slim_probe (struct slim_device *slim)
@@ -5197,17 +5194,15 @@ static int wcd9335_slim_status(struct slim_device *sdev,slim_get_logical_addr (wcd->slim_ifc_dev); wcd->regmap =regmap_init_slimbus (sdev, &wcd9335_regmap_config); -if (IS_ERR (wcd->regmap)) { -dev_err (dev,"Failed to allocate slim register map\n" ); -return PTR_ERR (wcd->regmap); - } +if (IS_ERR (wcd->regmap)) +return dev_err_probe (dev,PTR_ERR (wcd->regmap), +"Failed to allocate slim register map\n" ); wcd->if_regmap =regmap_init_slimbus (wcd->slim_ifc_dev, &wcd9335_ifc_regmap_config); -if (IS_ERR (wcd->if_regmap)) { -dev_err (dev,"Failed to allocate ifc register map\n" ); -return PTR_ERR (wcd->if_regmap); - } +if (IS_ERR (wcd->if_regmap)) +return dev_err_probe (dev,PTR_ERR (wcd->if_regmap), +"Failed to allocate ifc register map\n" ); ret =wcd9335_bring_up (wcd);if (ret) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 ASoC: codecs: wcd9335: Fix SLIM interface device leak in wcd9335_slim_status()
From: Wentao Liang <[email protected]>
[ Upstream commit 082723fee626532f176727b6438b666a96d5246c ]
of_slim_get_device() returns a device with an elevated reference count, and wcd->slim_ifc_dev is intentionally kept for the codec lifetime on success. However, all the failure paths of wcd9335_slim_status() return without dropping that reference, leaking the SLIM interface device whenever the register maps cannot be created or the codec fails to come up.
Put the device on each of those error paths.
--- sound/soc/codecs/wcd9335.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
sound/soc/codecs/wcd9335.c +10 -3
@@ -5194,25 +5194,32 @@ static int wcd9335_slim_status(struct slim_device *sdev,slim_get_logical_addr (wcd->slim_ifc_dev); wcd->regmap =regmap_init_slimbus (sdev, &wcd9335_regmap_config); -if (IS_ERR (wcd->regmap)) +if (IS_ERR (wcd->regmap)) { +put_device (&wcd->slim_ifc_dev->dev);return dev_err_probe (dev,PTR_ERR (wcd->regmap),"Failed to allocate slim register map\n" ); + } wcd->if_regmap =regmap_init_slimbus (wcd->slim_ifc_dev, &wcd9335_ifc_regmap_config); -if (IS_ERR (wcd->if_regmap)) +if (IS_ERR (wcd->if_regmap)) { +put_device (&wcd->slim_ifc_dev->dev);return dev_err_probe (dev,PTR_ERR (wcd->if_regmap),"Failed to allocate ifc register map\n" ); + } ret =wcd9335_bring_up (wcd);if (ret) {dev_err (dev,"Failed to bringup WCD9335\n" ); +put_device (&wcd->slim_ifc_dev->dev);return ret; } ret =wcd9335_irq_init (wcd); -if (ret) +if (ret) { +put_device (&wcd->slim_ifc_dev->dev);return ret; + }wcd9335_probe (wcd);
Signature · 1 line
2.53.0