]> git.baikalelectronics.ru Git - kernel.git/commit
media: v4l2-core: fix entity initialization in device_register_subdev
authorEugen Hristev <eugen.hristev@microchip.com>
Wed, 26 Feb 2020 15:28:16 +0000 (16:28 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 5 Mar 2020 21:45:03 +0000 (22:45 +0100)
commit4ab9e96db7f90f7afe17417c7c11b89a281f9aad
treea6b0b1f77cc6869fe699b891d2d95b84b062d576
parente4e8cfb3ff8446907e519dd6ac713b7066ea16b1
media: v4l2-core: fix entity initialization in device_register_subdev

The entity variable was being initialized in the wrong place, before the
parameters have been checked.
To solve this, completely removed the entity variable and replaced it
with the initialization value : &sd->entity.
This will avoid dereferencing 'sd' pointer before it's being checked if
it's NULL.

Fixes: e6c792c86ff8 ("[media] v4l: Make v4l2_subdev inherit from media_entity")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/v4l2-core/v4l2-device.c