mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-27 08:05:27 +08:00
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: Vladimirs Ambrosovs <rodriguez.twister@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
ff7d4f5981
commit
b3f6af36e5
@ -722,9 +722,16 @@ static __init int iio_dummy_init(void)
|
||||
for (i = 0; i < instances; i++) {
|
||||
ret = iio_dummy_probe(i);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto error_remove_devs;
|
||||
}
|
||||
return 0;
|
||||
|
||||
error_remove_devs:
|
||||
while (i--)
|
||||
iio_dummy_remove(i);
|
||||
|
||||
kfree(iio_dummy_devs);
|
||||
return ret;
|
||||
}
|
||||
module_init(iio_dummy_init);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user