]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: core: Clean up device correctly on viio_trigger_alloc() failure
authorSalah Triki <salah.triki@gmail.com>
Sat, 21 Feb 2026 07:32:42 +0000 (08:32 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 23 Feb 2026 20:44:31 +0000 (20:44 +0000)
commit12b393486c707dc005540da58f6c7a60776941ac
treed668d5ebc1a691e565592a12aa981eca640fb00d
parentd1e13ac7c2641a8ec815a9fe10835726eaf05302
iio: core: Clean up device correctly on viio_trigger_alloc() failure

Move device_initialize() after all error paths in viio_trigger_alloc().
Previously, put_device() should have been called on all error paths after
device_initialize(), but that was not done.

Rather than adding put_device(), move device_initialize() to avoid
needing to unwind it on error.

In addition move trig->dev initialization to just before device_initialize()
to related code together.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-trigger.c