From: Alexandru Ardelean Date: Mon, 21 Sep 2020 10:31:56 +0000 (+0300) Subject: iio: event: NULL-ify IIO device's event_interface ref during unregister X-Git-Tag: v5.10-rc1~126^2~44^2~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3598d14dc571b484529956b33f3fdd9d2b2b97e;p=thirdparty%2Fkernel%2Flinux.git iio: event: NULL-ify IIO device's event_interface ref during unregister Though we know that the iio_device_unregister_eventset() call is followed by the free-ing of the IIO device object, we should not make this assumption in the iio_device_unregister_eventset() function. It should allow for the clean unregistering of the event-set, allowing a re-register should we decide to implement this at some point later. Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20200921103156.194748-2-alexandru.ardelean@analog.com Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index a85919eb7c4ab..99ba657b85686 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c @@ -561,4 +561,5 @@ void iio_device_unregister_eventset(struct iio_dev *indio_dev) iio_free_chan_devattr_list(&ev_int->dev_attr_list); kfree(ev_int->group.attrs); kfree(ev_int); + iio_dev_opaque->event_interface = NULL; }