]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: core: Clean up device correctly on iio_device_alloc() failure
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 12 Nov 2025 14:55:09 +0000 (15:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:02 +0000 (14:03 +0100)
commite1cc8886b628c4ce2dedef4b41383bb2e3fef16f
treefebbcaea6c0f74706660d9517cb7c3dc2645e6b6
parent97d817c1145036f451cae939e71297f9fa9348da
iio: core: Clean up device correctly on iio_device_alloc() failure

[ Upstream commit b0e6871415b25f5e84a79621834e3d0c9d4627a6 ]

Once we called device_initialize() we have to call put_device()
on it. Refactor the code to make it in the right order.

Fixes: fe6f45f6ba22 ("iio: core: check return value when calling dev_set_name()")
Fixes: 847ec80bbaa7 ("Staging: IIO: core support for device registration and management")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/industrialio-core.c