• Tomi Valkeinen's avatar
    media: ti-vpe: cal: fix ctx uninitialization · 9e67f24e
    Tomi Valkeinen authored
    Somewhere along the way the context uninitialization has gone a bit odd:
    
    * We have cal_ctx_create() but no matching destroy call, but we still
    need to call cal_ctx_v4l2_cleanup() for each context.
    
    * We have cal_media_cleanup() which calls cal_ctx_v4l2_cleanup() for all
    contexts, but cal_media_init() is not where the contexts are created.
    
    * The order of uninit steps in cal_remove() is different than the error
    handling path in cal_probe().
    
    * cal_probe()'s error handling calls cal_ctx_v4l2_cleanup() for each
    context, but also calls cal_media_clean(), doing the same context
    cleanup twice.
    
    So fix these, by introducing cal_ctx_destroy(), and using that in
    appropriate places instead of calling cal_ctx_v4l2_cleanup() in
    cal_media_clean(). Also use normal kzalloc (and kfree) instead of devm
    version as we anyway do manual cleanup for each context.
    Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
    Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    9e67f24e
cal.c 30.9 KB