diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-08-23 05:41:47 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-08-24 04:53:58 -0300 |
commit | d345a5e59b0af5919f4d7f2a0d4c8dcae657e9d1 (patch) | |
tree | fa6778c9ab6a73dddf5d8b614a7604455e905656 /drivers/media/platform | |
parent | 5c47776a2d6e36f09c6162196155bd59e70edbfb (diff) |
[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>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/s3c-camif/camif-regs.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/platform/s3c-camif/camif-regs.c b/drivers/media/platform/s3c-camif/camif-regs.c index a9e3b16460b8..ebf5b184cce4 100644 --- a/drivers/media/platform/s3c-camif/camif-regs.c +++ b/drivers/media/platform/s3c-camif/camif-regs.c @@ -106,15 +106,15 @@ static const u32 src_pixfmt_map[8][2] = { void camif_hw_set_source_format(struct camif_dev *camif) { struct v4l2_mbus_framefmt *mf = &camif->mbus_fmt; - unsigned int i = ARRAY_SIZE(src_pixfmt_map); + int i; u32 cfg; - while (i-- >= 0) { + for (i = ARRAY_SIZE(src_pixfmt_map) - 1; i >= 0; i--) { if (src_pixfmt_map[i][0] == mf->code) break; } - - if (i == 0 && src_pixfmt_map[i][0] != mf->code) { + if (i < 0) { + i = 0; dev_err(camif->dev, "Unsupported pixel code, falling back to %#08x\n", src_pixfmt_map[i][0]); |