Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] rcar-vin: fix bug in pixelformat selection

If the requested pixelformat is not supported fallback to the default
format, do not revert the entire format.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Niklas Söderlund and committed by
Mauro Carvalho Chehab
e09c3481 8afb72ed

+5 -12
+5 -12
drivers/media/platform/rcar-vin/rcar-v4l2.c
··· 206 206 struct v4l2_pix_format *pix, 207 207 struct rvin_source_fmt *source) 208 208 { 209 - const struct rvin_video_format *info; 210 209 u32 rwidth, rheight, walign; 211 210 int ret; 212 211 ··· 217 218 if (pix->field == V4L2_FIELD_ANY) 218 219 pix->field = vin->format.field; 219 220 220 - /* 221 - * Retrieve format information and select the current format if the 222 - * requested format isn't supported. 223 - */ 224 - info = rvin_format_from_pixel(pix->pixelformat); 225 - if (!info) { 226 - vin_dbg(vin, "Format %x not found, keeping %x\n", 227 - pix->pixelformat, vin->format.pixelformat); 228 - *pix = vin->format; 229 - pix->width = rwidth; 230 - pix->height = rheight; 221 + /* If requested format is not supported fallback to the default */ 222 + if (!rvin_format_from_pixel(pix->pixelformat)) { 223 + vin_dbg(vin, "Format 0x%x not found, using default 0x%x\n", 224 + pix->pixelformat, RVIN_DEFAULT_FORMAT); 225 + pix->pixelformat = RVIN_DEFAULT_FORMAT; 231 226 } 232 227 233 228 /* Always recalculate */