Commit bbed5b89 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

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: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 9955d906
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -29,10 +29,15 @@ ia_css_ref_config(
{
	unsigned int elems_a = ISP_VEC_NELEMS, i;

	(void)size;
	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 +
+11 −0
Original line number Diff line number Diff line
@@ -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);