diff --git a/drivers/video/msm/ba/msm_ba.c b/drivers/video/msm/ba/msm_ba.c index 63be3a69a079..30464baa7934 100644 --- a/drivers/video/msm/ba/msm_ba.c +++ b/drivers/video/msm/ba/msm_ba.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2016, 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 @@ -524,14 +524,18 @@ int msm_ba_save_restore_input(void *instance, enum msm_ba_save_restore_ip sr) msm_ba_reset_ip_in_use_from_sd(inst->sd); ba_input = msm_ba_find_input_from_sd(inst->sd, inst->saved_input); - ba_input->in_use = 1; + if (ba_input) + ba_input->in_use = 1; + else + dprintk(BA_WARN, "Could not find input %d from sd: %s", + inst->saved_input, inst->sd->name); inst->restore = 0; inst->saved_input = BA_IP_MAX; dprintk(BA_DBG, "Stream on from save restore"); rc = msm_ba_streamon(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); } else if (sr == BA_SR_SAVE_IP) { ba_input = msm_ba_find_input(inst->sd_input.index); - if (ba_input->ba_out_in_use) { + if (ba_input && ba_input->ba_out_in_use) { inst->restore = 1; inst->saved_input = msm_ba_find_ip_in_use_from_sd(inst->sd); @@ -543,6 +547,9 @@ int msm_ba_save_restore_input(void *instance, enum msm_ba_save_restore_ip sr) inst->saved_input); rc = -EBUSY; } + if (!ba_input) + dprintk(BA_WARN, "Couldn't find input idx %d to save", + inst->sd_input.index); } else { dprintk(BA_DBG, "Nothing to do in save and restore"); }