From: Yang Yingliang <hidden> Date: 2022-10-27 01:36:54
dev_set_name() in soundbus_add_one() allocates memory for name, it need be
freed when of_device_register() fails, call soundbus_dev_put() to give up
the reference that hold in device_initialize(), so that it can be freed in
kobject_cleanup() when the refcount hit to 0. And other resources are also
freed in i2sbus_release_dev(), so it can return 0 directly.
Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
Signed-off-by: Yang Yingliang <redacted>
---
sound/aoa/soundbus/i2sbus/core.c | 4 ++++
1 file changed, 4 insertions(+)
On Thu, 27 Oct 2022 03:34:38 +0200,
Yang Yingliang wrote:
dev_set_name() in soundbus_add_one() allocates memory for name, it need be
freed when of_device_register() fails, call soundbus_dev_put() to give up
the reference that hold in device_initialize(), so that it can be freed in
kobject_cleanup() when the refcount hit to 0. And other resources are also
freed in i2sbus_release_dev(), so it can return 0 directly.
Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
Signed-off-by: Yang Yingliang <redacted>
The check of kobj state is awkward, but it seems to be the simplest
way... Applied now. Thanks!
Takashi
From: Yang Yingliang <hidden> Date: 2022-10-27 07:41:47
On 2022/10/27 14:38, Takashi Iwai wrote:
On Thu, 27 Oct 2022 03:34:38 +0200,
Yang Yingliang wrote:
quoted
dev_set_name() in soundbus_add_one() allocates memory for name, it need be
freed when of_device_register() fails, call soundbus_dev_put() to give up
the reference that hold in device_initialize(), so that it can be freed in
kobject_cleanup() when the refcount hit to 0. And other resources are also
freed in i2sbus_release_dev(), so it can return 0 directly.
Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
Signed-off-by: Yang Yingliang <redacted>
The check of kobj state is awkward, but it seems to be the simplest
way... Applied now. Thanks!
Indeed, it's awkward, shall we introduce a helper like this:
diff --git a/sound/aoa/soundbus/i2sbus/core.c
b/sound/aoa/soundbus/i2sbus/core.c
index f6841daf9e3b..950c37e0297e 100644
On Thu, 27 Oct 2022 09:41:03 +0200,
Yang Yingliang wrote:
quoted hunk
On 2022/10/27 14:38, Takashi Iwai wrote:
quoted
On Thu, 27 Oct 2022 03:34:38 +0200,
Yang Yingliang wrote:
quoted
dev_set_name() in soundbus_add_one() allocates memory for name, it need be
freed when of_device_register() fails, call soundbus_dev_put() to give up
the reference that hold in device_initialize(), so that it can be freed in
kobject_cleanup() when the refcount hit to 0. And other resources are also
freed in i2sbus_release_dev(), so it can return 0 directly.
Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
Signed-off-by: Yang Yingliang <redacted>
The check of kobj state is awkward, but it seems to be the simplest
way... Applied now. Thanks!
Indeed, it's awkward, shall we introduce a helper like this:
diff --git a/sound/aoa/soundbus/i2sbus/core.c
b/sound/aoa/soundbus/i2sbus/core.c
index f6841daf9e3b..950c37e0297e 100644