struct resource *res;
        struct pci_dev *pcidev = dev_is_pci(parent) ? to_pci_dev(parent) : NULL;
        const struct pci_device_id *pcidev_id = NULL;
-       enum pxa_ssp_type type;
+       enum pxa_ssp_type type = SSP_UNDEFINED;
        const void *match;
        int status;
        u64 uid;
                type = (enum pxa_ssp_type)match;
        else if (pcidev_id)
                type = (enum pxa_ssp_type)pcidev_id->driver_data;
-       else
+
+       /* Validate the SSP type correctness */
+       if (!(type > SSP_UNDEFINED && type < SSP_MAX))
                return ERR_PTR(-EINVAL);
 
        pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);