media: v4l: subdev: Fail graciously when getting try data for NULL state
authorSakari Ailus <sakari.ailus@linux.intel.com>
Fri, 26 Aug 2022 11:53:58 +0000 (13:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 17:15:34 +0000 (18:15 +0100)
commit8ecd1db58b7acbf87651f9d78478e2feb7cbf907
treef72fce83b3de2d98643b07b14891c84980b138fe
parentf96ad391d054bd5c36994f98afd6a12cbb5600bf
media: v4l: subdev: Fail graciously when getting try data for NULL state

[ Upstream commit 2ba3e38517f5a4ebf9c997168079dca01b7f9fc6 ]

The state argument for the functions for obtaining various parts of the
state is NULL if it is called by drivers for active state. Fail graciously
in that case instead of dereferencing a NULL pointer.

Suggested-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/media/v4l2-subdev.h