struct snd_sof_dev *sdev;
        int stream_tag;
 
+       if (!ops) {
+               dev_err(cpu_dai->dev, "DAI widget ops not set\n");
+               return -EINVAL;
+       }
+
        sdev = dai_to_sdev(substream, cpu_dai);
 
        hlink = snd_hdac_ext_bus_get_hlink_by_name(bus, codec_dai->component->name);
        unsigned int link_bps;
        int stream_tag;
 
+       if (!ops) {
+               dev_err(cpu_dai->dev, "DAI widget ops not set\n");
+               return -EINVAL;
+       }
+
        sdev = dai_to_sdev(substream, cpu_dai);
        bus = sof_to_bus(sdev);
 
        struct snd_sof_dev *sdev = dai_to_sdev(substream, cpu_dai);
 
        if (!ops) {
-               dev_err(sdev->dev, "DAI widget ops not set\n");
+               dev_err(cpu_dai->dev, "DAI widget ops not set\n");
                return -EINVAL;
        }
 
        struct snd_sof_dev *sdev;
        int ret;
 
+       if (!ops) {
+               dev_err(dai->dev, "DAI widget ops not set\n");
+               return -EINVAL;
+       }
+
        dev_dbg(dai->dev, "cmd=%d dai %s direction %d\n", cmd,
                dai->name, substream->stream);