Commit 100f720a authored by Helen Koike's avatar Helen Koike Committed by Mauro Carvalho Chehab

media: staging: rkisp1: isp: do not set invalid mbus code for pad

When setting source pad, check if the given mbus code is indeed valid
for source pad, if not, then set the default code.
Same for sink pad.

Fixes: d65dd852 ("media: staging: rkisp1: add Rockchip ISP1 base driver")
Reported-by: default avatarWojciech Zabolotny <wzab01@gmail.com>
Signed-off-by: default avatarHelen Koike <helen.koike@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 20e46fc1
...@@ -683,7 +683,7 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp, ...@@ -683,7 +683,7 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
src_fmt->code = format->code; src_fmt->code = format->code;
mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code); mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code);
if (!mbus_info) { if (!mbus_info || !(mbus_info->direction & RKISP1_DIR_SRC)) {
src_fmt->code = RKISP1_DEF_SRC_PAD_FMT; src_fmt->code = RKISP1_DEF_SRC_PAD_FMT;
mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code); mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code);
} }
...@@ -767,7 +767,7 @@ static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp, ...@@ -767,7 +767,7 @@ static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp,
which); which);
sink_fmt->code = format->code; sink_fmt->code = format->code;
mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code); mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
if (!mbus_info) { if (!mbus_info || !(mbus_info->direction & RKISP1_DIR_SINK)) {
sink_fmt->code = RKISP1_DEF_SINK_PAD_FMT; sink_fmt->code = RKISP1_DEF_SINK_PAD_FMT;
mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code); mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment