]> 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)
commitec55f906143ce55bb976c48763039e9f0f0d6fec
treea6b0b1f77cc6869fe699b891d2d95b84b062d576
parent574364c8f5a4ed62c654f30c9ee59deb72f1b4f2
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