Skip to content

Commit f1fae47

Browse files
committed
ALSA: aoa: Fix I2S device accounting
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: f3d9478 ("[ALSA] snd-aoa: add snd-aoa") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent f0a8687 commit f1fae47

File tree

1 file changed

+2
-1
lines changed
  • sound/aoa/soundbus/i2sbus

1 file changed

+2
-1
lines changed

sound/aoa/soundbus/i2sbus/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
147147
return rc;
148148
}
149149

150+
/* Returns 1 if added, 0 for otherwise; don't return a negative value! */
150151
/* FIXME: look at device node refcounting */
151152
static int i2sbus_add_dev(struct macio_dev *macio,
152153
struct i2sbus_control *control,
@@ -213,7 +214,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
213214
* either as the second one in that case is just a modem. */
214215
if (!ok) {
215216
kfree(dev);
216-
return -ENODEV;
217+
return 0;
217218
}
218219

219220
mutex_init(&dev->lock);

0 commit comments

Comments
 (0)