[PATCH 14/18] media: coda: Fix handling wrong format in coda_try_fmt

Sergey Khimich posted 18 patches 9 months, 1 week ago
[PATCH 14/18] media: coda: Fix handling wrong format in coda_try_fmt
Posted by Sergey Khimich 9 months, 1 week ago
From: Vladimir Yakovlev <vovchkir@gmail.com>

No need to print BUG() report when received wrong format
in coda_try_fmt. It's enough to print log and return an error.

Co-developed-by: Sergey Khimich <serghox@gmail.com>
Signed-off-by: Sergey Khimich <serghox@gmail.com>
Signed-off-by: Vladimir Yakovlev <vovchkir@gmail.com>
---
 drivers/media/platform/chips-media/coda/coda-common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/chips-media/coda/coda-common.c b/drivers/media/platform/chips-media/coda/coda-common.c
index 29b01ade8829..9b443ddabeab 100644
--- a/drivers/media/platform/chips-media/coda/coda-common.c
+++ b/drivers/media/platform/chips-media/coda/coda-common.c
@@ -644,7 +644,9 @@ static int coda_try_fmt(struct coda_ctx *ctx, const struct coda_codec *codec,
 							f->fmt.pix.height);
 		break;
 	default:
-		BUG();
+		v4l2_warn(&dev->v4l2_dev, "Warning: wrong format=0x%04X",
+			  f->fmt.pix.pixelformat);
+		return -EINVAL;
 	}
 
 	return 0;
-- 
2.30.2