Return -EINVAL if invalid bus-type is detected while parsing endpoints.
Fixes: 26c1126c9b56 ("media: v4l: fwnode: Use media bus type for bus parser selection")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
        const struct v4l2_fwnode_bus_conv *conv =
                get_v4l2_fwnode_bus_conv_by_fwnode_bus(type);
 
-       return conv ? conv->mbus_type : V4L2_MBUS_UNKNOWN;
+       return conv ? conv->mbus_type : V4L2_MBUS_INVALID;
 }
 
 static const char *
                 v4l2_fwnode_mbus_type_to_string(vep->bus_type),
                 vep->bus_type);
        mbus_type = v4l2_fwnode_bus_type_to_mbus(bus_type);
+       if (mbus_type == V4L2_MBUS_INVALID) {
+               pr_debug("unsupported bus type %u\n", bus_type);
+               return -EINVAL;
+       }
 
        if (vep->bus_type != V4L2_MBUS_UNKNOWN) {
                if (mbus_type != V4L2_MBUS_UNKNOWN &&
 
  * @V4L2_MBUS_CCP2:    CCP2 (Compact Camera Port 2)
  * @V4L2_MBUS_CSI2_DPHY: MIPI CSI-2 serial interface, with D-PHY
  * @V4L2_MBUS_CSI2_CPHY: MIPI CSI-2 serial interface, with C-PHY
+ * @V4L2_MBUS_INVALID: invalid bus type (keep as last)
  */
 enum v4l2_mbus_type {
        V4L2_MBUS_UNKNOWN,
        V4L2_MBUS_CCP2,
        V4L2_MBUS_CSI2_DPHY,
        V4L2_MBUS_CSI2_CPHY,
+       V4L2_MBUS_INVALID,
 };
 
 /**