struct device_node *node = dev->of_node;
        struct device_node *ep;
        const struct of_device_id *of_id = of_match_device(test_of_match, &pdev->dev);
-       const struct test_adata *adata = of_id->data;
+       const struct test_adata *adata;
        struct snd_soc_component_driver *cdriv;
        struct snd_soc_dai_driver *ddriv;
        struct test_dai_name *dname;
        struct test_priv *priv;
        int num, ret, i;
 
+       if (!of_id)
+               return -EINVAL;
+       adata = of_id->data;
        num = of_graph_get_endpoint_count(node);
        if (!num) {
                dev_err(dev, "no port exits\n");