diff mbox series

[v3,4/5] media: v4l2-subdev: v4l2_subdev_free_state() to accept a NULL state

Message ID 20210610094903.343183-3-tomi.valkeinen@ideasonboard.com
State New
Headers show
Series media: v4l2-subdev: add subdev-wide state struct | expand

Commit Message

Tomi Valkeinen June 10, 2021, 9:49 a.m. UTC
Make v4l2_subdev_free_state() accept a NULL state.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

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);