The dev_attr list is initialized in __iio_add_event_config_attrs which
is called only when indio_dev->channels is true. Nevertheless the list
is used unconditionally later in iio_device_register_eventset which
results in a NULL pointer exception. To fix this unconditionally
initialize the list in iio_device_register_eventset.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
{
int j, ret, attrcount = 0;
- INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list);
/* Dynically created from the channels array */
for (j = 0; j < indio_dev->num_channels; j++) {
ret = iio_device_add_event_sysfs(indio_dev,
goto error_ret;
}
+ INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list);
+
iio_setup_ev_int(indio_dev->event_interface);
if (indio_dev->info->event_attrs != NULL) {
attr = indio_dev->info->event_attrs->attrs;