diff --git a/sound/soc/sof/hw-spi.c b/sound/soc/sof/hw-spi.c index 883f53767294b5..6f2d745a4a4987 100644 --- a/sound/soc/sof/hw-spi.c +++ b/sound/soc/sof/hw-spi.c @@ -181,6 +181,16 @@ static int spi_get_reply(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg) int ret = 0; u32 size; + /* + * Sometimes, there is unexpected reply ipc arriving. The reply + * ipc belongs to none of the ipcs sent from driver. + * In this case, the driver must ignore the ipc. + */ + if (!msg) { + dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n"); + return 0; + } + /* get reply */ spi_mailbox_read(sdev, sdev->host_box.offset, &reply, sizeof(reply)); if (reply.error < 0) { diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c index 2483eaa5957105..6bc98f81f34152 100644 --- a/sound/soc/sof/intel/bdw.c +++ b/sound/soc/sof/intel/bdw.c @@ -488,6 +488,16 @@ static void bdw_get_reply(struct snd_sof_dev *sdev) unsigned long flags; int ret = 0; + /* + * Sometimes, there is unexpected reply ipc arriving. The reply + * ipc belongs to none of the ipcs sent from driver. + * In this case, the driver must ignore the ipc. + */ + if (!msg) { + dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n"); + return; + } + /* get reply */ sof_mailbox_read(sdev, sdev->host_box.offset, &reply, sizeof(reply)); diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c index 2975cbea950642..e1b6ab04fd9f9f 100644 --- a/sound/soc/sof/intel/byt.c +++ b/sound/soc/sof/intel/byt.c @@ -386,6 +386,16 @@ static void byt_get_reply(struct snd_sof_dev *sdev) unsigned long flags; int ret = 0; + /* + * Sometimes, there is unexpected reply ipc arriving. The reply + * ipc belongs to none of the ipcs sent from driver. + * In this case, the driver must ignore the ipc. + */ + if (!msg) { + dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n"); + return; + } + /* get reply */ sof_mailbox_read(sdev, sdev->host_box.offset, &reply, sizeof(reply)); diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c index 6924d8504d09c3..2d07ac6628fef2 100644 --- a/sound/soc/sof/intel/hda-ipc.c +++ b/sound/soc/sof/intel/hda-ipc.c @@ -75,6 +75,15 @@ void hda_dsp_ipc_get_reply(struct snd_sof_dev *sdev) unsigned long flags; int ret = 0; + /* + * Sometimes, there is unexpected reply ipc arriving. The reply + * ipc belongs to none of the ipcs sent from driver. + * In this case, the driver must ignore the ipc. + */ + if (!msg) { + dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n"); + return; + } spin_lock_irqsave(&sdev->ipc_lock, flags); hdr = msg->msg_data; diff --git a/sound/soc/sof/intel/hsw.c b/sound/soc/sof/intel/hsw.c index ee921ab5360b4b..a9145a566aca42 100644 --- a/sound/soc/sof/intel/hsw.c +++ b/sound/soc/sof/intel/hsw.c @@ -489,6 +489,16 @@ static void hsw_get_reply(struct snd_sof_dev *sdev) unsigned long flags; int ret = 0; + /* + * Sometimes, there is unexpected reply ipc arriving. The reply + * ipc belongs to none of the ipcs sent from driver. + * In this case, the driver must ignore the ipc. + */ + if (!msg) { + dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n"); + return; + } + spin_lock_irqsave(&sdev->ipc_lock, flags); /* get reply */