[media] s5p-mfc: Use printk_ratelimited for reporting ioctl errors
authorMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 16 Nov 2016 09:04:51 +0000 (07:04 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 30 Nov 2016 11:16:23 +0000 (09:16 -0200)
Some applications don't check error codes from QBUF/DQBUF ioctls,
so don't spam kernel log with errors if they fall into endless loop
trying to queue next buffer after a failure.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/s5p-mfc/s5p_mfc_debug.h
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c

index 5936923..1936a5b 100644 (file)
@@ -39,6 +39,12 @@ extern int mfc_debug_level;
                       __func__, __LINE__, ##args);     \
        } while (0)
 
+#define mfc_err_limited(fmt, args...)                  \
+       do {                                            \
+               printk_ratelimited(KERN_ERR "%s:%d: " fmt,      \
+                      __func__, __LINE__, ##args);     \
+       } while (0)
+
 #define mfc_info(fmt, args...)                         \
        do {                                            \
                printk(KERN_INFO "%s:%d: " fmt,         \
index cf787ea..367ef8e 100644 (file)
@@ -642,7 +642,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
        int ret;
 
        if (ctx->state == MFCINST_ERROR) {
-               mfc_err("Call on DQBUF after unrecoverable error\n");
+               mfc_err_limited("Call on DQBUF after unrecoverable error\n");
                return -EIO;
        }
 
index fcc2e05..e39d9e0 100644 (file)
@@ -1268,7 +1268,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
        int ret;
 
        if (ctx->state == MFCINST_ERROR) {
-               mfc_err("Call on DQBUF after unrecoverable error\n");
+               mfc_err_limited("Call on DQBUF after unrecoverable error\n");
                return -EIO;
        }
        if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {