diff --git a/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c b/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c index fa400918f62b9..42bf1ba305bdc 100644 --- a/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c +++ b/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -39,6 +39,8 @@ struct msm_vidc_drv *vidc_driver; static inline struct msm_vidc_inst *get_vidc_inst(struct file *filp, void *fh) { + if (!filp->private_data) + return NULL; return container_of(filp->private_data, struct msm_vidc_inst, event_handler); } @@ -74,6 +76,7 @@ static int msm_v4l2_close(struct file *filp) vidc_inst = get_vidc_inst(filp, NULL); rc = msm_vidc_close(vidc_inst); + filp->private_data = NULL; trace_msm_v4l2_vidc_close_end("msm_v4l2_close end"); return rc; }