提交 b3f6af36 编写于 作者: V Vladimirs Ambrosovs 提交者: Jonathan Cameron

staging: iio_simple_dummy: fix init function

This patch fixes the init function for the iio_simple_dummy driver.
The main issues were absence of kfree for the allocated array, and no
devices being removed in case the probe function fails, running in a loop.
Signed-off-by: NVladimirs Ambrosovs <rodriguez.twister@gmail.com>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 ff7d4f59
...@@ -722,9 +722,16 @@ static __init int iio_dummy_init(void) ...@@ -722,9 +722,16 @@ static __init int iio_dummy_init(void)
for (i = 0; i < instances; i++) { for (i = 0; i < instances; i++) {
ret = iio_dummy_probe(i); ret = iio_dummy_probe(i);
if (ret < 0) if (ret < 0)
return ret; goto error_remove_devs;
} }
return 0; return 0;
error_remove_devs:
while (i--)
iio_dummy_remove(i);
kfree(iio_dummy_devs);
return ret;
} }
module_init(iio_dummy_init); module_init(iio_dummy_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册