Skip to contentSkip to conversation

v4l2-event: Remove pending events from fh event queue when unsubscribing

PATCH Hans de Goede 1 participant 1 message Nov 1, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi,

Quoted 5 lines · hverkuil
Quoted 2 lines

This patch fixes these dangling pointers in the available queue by removing all matching pending events on unsubscription.

The idea is fine, but the implementation is inefficient.

Quoted 8 lines

Instead of the list_for_each_entry_safe you can just do:

	for (i = 0; i < sev->in_use; i++) {
		list_del(&sev->events[sev_pos(sev, i)].list);
		fh->navailable--;
	}

It's untested, but this should do the trick.

Agreed, I've modified my patch to use this construction instead.

Regards,

Hans