[media] s5p-jpeg: return error immediately after get_byte fails
authorJacek Anaszewski <j.anaszewski@samsung.com>
Fri, 11 Jul 2014 15:19:43 +0000 (12:19 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 30 Jul 2014 22:16:03 +0000 (19:16 -0300)
When parsing JPEG header s5p_jpeg_parse_hdr function
should return immediately in case there was an error
while reading a byte.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/s5p-jpeg/jpeg-core.c

index 126199e010c7161bae30d6f69db51eb386b98ffe..a3f8862e60f0c47a2b36eb062796603261088a2c 100644 (file)
@@ -906,14 +906,14 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result,
        while (notfound) {
                c = get_byte(&jpeg_buffer);
                if (c == -1)
-                       break;
+                       return false;
                if (c != 0xff)
                        continue;
                do
                        c = get_byte(&jpeg_buffer);
                while (c == 0xff);
                if (c == -1)
-                       break;
+                       return false;
                if (c == 0)
                        continue;
                length = 0;