ASoC: SOF: ipc: Add check for mandatory IPC message handling ops
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Tue, 5 Apr 2022 17:27:02 +0000 (10:27 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 11 Apr 2022 18:17:55 +0000 (19:17 +0100)
Make sure that the mandatory IPC message handling ops are provided by the
IPC implementation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-10-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc.c

index 4966a2a..d11c5e6 100644 (file)
@@ -1066,6 +1066,11 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev)
        ops = ipc->ops;
 
        /* check for mandatory ops */
+       if (!ops->tx_msg || !ops->rx_msg || !ops->set_get_data || !ops->get_reply) {
+               dev_err(sdev->dev, "Missing IPC message handling ops\n");
+               return NULL;
+       }
+
        if (!ops->pcm) {
                dev_err(sdev->dev, "Missing IPC PCM ops\n");
                return NULL;