mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 14:42:08 +02:00
media: v4l: Safely to call v4l2_subdev_cleanup on an uninitialised subdev
Graciously handle an uninitialised (but still zeroed) sub-device in v4l2_subdev_cleanup(). The list_empty() check there is unnecessary, too, so replace that by cheking whether the lists's next field is NULL. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
fb16c04a53
commit
ab8d7194ac
|
|
@ -1521,7 +1521,8 @@ void v4l2_subdev_cleanup(struct v4l2_subdev *sd)
|
|||
__v4l2_subdev_state_free(sd->active_state);
|
||||
sd->active_state = NULL;
|
||||
|
||||
if (list_empty(&sd->async_subdev_endpoint_list))
|
||||
/* Uninitialised sub-device, bail out here. */
|
||||
if (!sd->async_subdev_endpoint_list.next)
|
||||
return;
|
||||
|
||||
list_for_each_entry_safe(ase, ase_tmp, &sd->async_subdev_endpoint_list,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user