Make v4l2_subdev_free_state() accept a NULL state. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx> --- drivers/media/v4l2-core/v4l2-subdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index dacae53b68d5..25c80d6de23b 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -931,7 +931,8 @@ EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_state); void v4l2_subdev_free_state(struct v4l2_subdev_state *state) { - kvfree(state->pads); + if (state) + kvfree(state->pads); kfree(state); } EXPORT_SYMBOL_GPL(v4l2_subdev_free_state); -- 2.25.1