mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-14 01:34:43 +08:00
ALSA: aoa: Fix I2S device accounting
[ Upstream commitf1fae475f1
] 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:f3d9478b2c
("[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>
This commit is contained in:
parent
e81d7826b8
commit
9a1c1df925
@ -147,6 +147,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns 1 if added, 0 for otherwise; don't return a negative value! */
|
||||||
/* FIXME: look at device node refcounting */
|
/* FIXME: look at device node refcounting */
|
||||||
static int i2sbus_add_dev(struct macio_dev *macio,
|
static int i2sbus_add_dev(struct macio_dev *macio,
|
||||||
struct i2sbus_control *control,
|
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. */
|
* either as the second one in that case is just a modem. */
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
kfree(dev);
|
kfree(dev);
|
||||||
return -ENODEV;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_init(&dev->lock);
|
mutex_init(&dev->lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user