mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
media: v4l2-async: Unregister sub-device if asc_list is empty
When my em28xx USB device that uses the i2c tvp5150 driver is
disconnected, it crashes.
The cause is that the tvp5150 i2c module uses v4l2_async, but
the em28xx driver does not since it predates v4l2_async.
In that corner case sd->asc_list is empty, so
v4l2_async_unregister_subdev() never calls v4l2_device_unregister_subdev().
Modify the code so that, if sd->asc_list is empty,
v4l2_device_unregister_subdev() is still called.
Fixes: 28a1295795 ("media: v4l: async: Allow multiple connections between entities")
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
85aa812245
commit
4e72f13d58
|
|
@ -898,9 +898,18 @@ void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
|
|||
sd->subdev_notifier = NULL;
|
||||
|
||||
if (sd->asc_list.next) {
|
||||
list_for_each_entry_safe(asc, asc_tmp, &sd->asc_list,
|
||||
asc_subdev_entry) {
|
||||
v4l2_async_unbind_subdev_one(asc->notifier, asc);
|
||||
if (list_empty(&sd->asc_list)) {
|
||||
/*
|
||||
* If the sub-device was registered through other means
|
||||
* than v4l2-async, there are no async connections but
|
||||
* the sub-device may still well be registered.
|
||||
* Unregister it now.
|
||||
*/
|
||||
v4l2_device_unregister_subdev(sd);
|
||||
} else {
|
||||
list_for_each_entry_safe(asc, asc_tmp, &sd->asc_list,
|
||||
asc_subdev_entry)
|
||||
v4l2_async_unbind_subdev_one(asc->notifier, asc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user