media: atomisp: avoid OOPS due to non-existing ref_frames

stage->args->delay_frames array could point to NULL frames.

What's weird is that we didn't notice this behavior with the
Intel Aero Yocto code.

Handle it, while adding a notice at the code, as this could
be due to some broken pipeline setup.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2020-05-27 15:46:54 +02:00
parent 9955d906f2
commit bbed5b89e1
2 changed files with 20 additions and 4 deletions

View file

@ -29,10 +29,15 @@ ia_css_ref_config(
{
unsigned int elems_a = ISP_VEC_NELEMS, i;
(void)size;
ia_css_dma_configure_from_info(&to->port_b, &from->ref_frames[0]->info);
to->width_a_over_b = elems_a / to->port_b.elems;
to->dvs_frame_delay = from->dvs_frame_delay;
if (from->ref_frames[0]) {
ia_css_dma_configure_from_info(&to->port_b, &from->ref_frames[0]->info);
to->width_a_over_b = elems_a / to->port_b.elems;
to->dvs_frame_delay = from->dvs_frame_delay;
} else {
to->width_a_over_b = 1;
to->dvs_frame_delay = 0;
to->port_b.elems = elems_a;
}
for (i = 0; i < MAX_NUM_VIDEO_DELAY_FRAMES; i++) {
if (from->ref_frames[i]) {
to->ref_frame_addr_y[i] = from->ref_frames[i]->data +

View file

@ -839,6 +839,17 @@ configure_isp_from_args(
ia_css_dvs_configure(binary, &args->out_frame[0]->info);
ia_css_output_configure(binary, &args->out_frame[0]->info);
ia_css_raw_configure(pipeline, binary, &args->in_frame->info, &binary->in_frame_info, two_ppc, deinterleaved);
/*
* FIXME: args->delay_frames can be NULL here
*
* Somehow, the driver at the Intel Atom Yocto tree doesn't seem to
* suffer from the same issue.
*
* Anyway, the function below should now handle a NULL delay_frames
* without crashing, but the pipeline should likely be built without
* adding it at the first place (or there are a hidden bug somewhere)
*/
ia_css_ref_configure(binary, args->delay_frames, pipeline->dvs_frame_delay);
ia_css_tnr_configure(binary, args->tnr_frames);
ia_css_bayer_io_config(binary, args);