[PATCH 2/2] media: mali-c55: Never match an unset media bus code

From: David Carlier

Date: Sat Dec 05 2026 - 16:28:10 EST


Formats with a single media bus code leave the second mbus_codes[] slot
at zero, so a code of 0 matches all of them. Nothing sets a zero code
anymore, but link validation should not accept one. Reject it up front.

Signed-off-by: David Carlier <devnexen@xxxxxxxxx>
---
drivers/media/platform/arm/mali-c55/mali-c55-capture.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-capture.c b/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
index d6f155dd5255..0bb85f6bda3e 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
@@ -233,6 +233,10 @@ mali_c55_mbus_code_can_produce_fmt(const struct mali_c55_format_info *fmt,
{
unsigned int i;

+ /* Unused mbus_codes[] slots are zero, never match them. */
+ if (!code)
+ return false;
+
for (i = 0; i < ARRAY_SIZE(fmt->mbus_codes); i++) {
if (fmt->mbus_codes[i] == code)
return true;
--
2.55.0