[media] s3c-camif: forever loop in camif_hw_set_source_format()
Because "i" is unsigned then "i-- >= 0" is always true. If we don't find what we are looking for then we loop forever. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
5c47776a2d
commit
d345a5e59b
|
@ -106,15 +106,15 @@ static const u32 src_pixfmt_map[8][2] = {
|
||||||
void camif_hw_set_source_format(struct camif_dev *camif)
|
void camif_hw_set_source_format(struct camif_dev *camif)
|
||||||
{
|
{
|
||||||
struct v4l2_mbus_framefmt *mf = &camif->mbus_fmt;
|
struct v4l2_mbus_framefmt *mf = &camif->mbus_fmt;
|
||||||
unsigned int i = ARRAY_SIZE(src_pixfmt_map);
|
int i;
|
||||||
u32 cfg;
|
u32 cfg;
|
||||||
|
|
||||||
while (i-- >= 0) {
|
for (i = ARRAY_SIZE(src_pixfmt_map) - 1; i >= 0; i--) {
|
||||||
if (src_pixfmt_map[i][0] == mf->code)
|
if (src_pixfmt_map[i][0] == mf->code)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (i < 0) {
|
||||||
if (i == 0 && src_pixfmt_map[i][0] != mf->code) {
|
i = 0;
|
||||||
dev_err(camif->dev,
|
dev_err(camif->dev,
|
||||||
"Unsupported pixel code, falling back to %#08x\n",
|
"Unsupported pixel code, falling back to %#08x\n",
|
||||||
src_pixfmt_map[i][0]);
|
src_pixfmt_map[i][0]);
|
||||||
|
|
Loading…
Reference in New Issue