#endif /* IPA_VALIDATE */
 }
 
+static bool ipa_version_valid(enum ipa_version version)
+{
+       switch (version) {
+       case IPA_VERSION_3_0:
+       case IPA_VERSION_3_1:
+       case IPA_VERSION_3_5:
+       case IPA_VERSION_3_5_1:
+       case IPA_VERSION_4_0:
+       case IPA_VERSION_4_1:
+       case IPA_VERSION_4_2:
+       case IPA_VERSION_4_5:
+       case IPA_VERSION_4_7:
+       case IPA_VERSION_4_9:
+       case IPA_VERSION_4_11:
+               return true;
+
+       default:
+               return false;
+       }
+}
+
 /**
  * ipa_probe() - IPA platform driver probe function
  * @pdev:      Platform device pointer
        /* Get configuration data early; needed for clock initialization */
        data = of_device_get_match_data(dev);
        if (!data) {
-               /* This is really IPA_VALIDATE (should never happen) */
                dev_err(dev, "matched hardware not supported\n");
                return -ENODEV;
        }
 
+       if (!ipa_version_valid(data->version)) {
+               dev_err(dev, "invalid IPA version\n");
+               return -EINVAL;
+       }
+
        /* If we need Trust Zone, make sure it's available */
        modem_init = of_property_read_bool(dev->of_node, "modem-init");
        if (!modem_init)