summaryrefslogtreecommitdiffstats
path: root/sound/aoa
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2022-10-27 08:52:33 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-11-03 23:52:33 +0900
commit96e4b1fe3e334a7815716b21f74d55e4602b4d9d (patch)
tree6289d696105168424703f3d143217188d35e5ccf /sound/aoa
parent027fee10e3a400cf6f3237374a1248da1082807b (diff)
downloadlinux-stable-96e4b1fe3e334a7815716b21f74d55e4602b4d9d.tar.gz
linux-stable-96e4b1fe3e334a7815716b21f74d55e4602b4d9d.tar.bz2
linux-stable-96e4b1fe3e334a7815716b21f74d55e4602b4d9d.zip
ALSA: aoa: Fix I2S device accounting
[ Upstream commit f1fae475f10a26b7e34da4ff2e2f19b7feb3548e ] i2sbus_add_dev() is supposed to return the number of probed devices, i.e. either 1 or 0. However, i2sbus_add_dev() has one error handling that returns -ENODEV; this will screw up the accumulation number counted in the caller, i2sbus_probe(). Fix the return value to 0 and add the comment for better understanding for readers. Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa") Link: https://lore.kernel.org/r/20221027065233.13292-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound/aoa')
-rw-r--r--sound/aoa/soundbus/i2sbus/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
index c016df586992..2811e1f1e2fa 100644
--- a/sound/aoa/soundbus/i2sbus/core.c
+++ b/sound/aoa/soundbus/i2sbus/core.c
@@ -148,6 +148,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
return rc;
}
+/* Returns 1 if added, 0 for otherwise; don't return a negative value! */
/* FIXME: look at device node refcounting */
static int i2sbus_add_dev(struct macio_dev *macio,
struct i2sbus_control *control,
@@ -213,7 +214,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
* either as the second one in that case is just a modem. */
if (!ok) {
kfree(dev);
- return -ENODEV;
+ return 0;
}
mutex_init(&dev->lock);