ASoC: Intel: Check Haswell IPC process_reply/notification return value.
diff mbox

Message ID 1394117766-7242-1-git-send-email-liam.r.girdwood@linux.intel.com
State Accepted
Commit f69f41e1a2568f2ebdcf021fe216c1e9ba24cc1f
Headers show

Commit Message

Liam Girdwood March 6, 2014, 2:56 p.m. UTC
Check the return value for error when processing replies and notifications.

The patch 22981243589c: "ASoC: Intel: Add Haswell/Broadwell IPC" from
> Feb 20, 2014, leads to the following imaginary static checker warning:
>
> 	sound/soc/intel/sst-haswell-ipc.c:898 hsw_irq_thread()
> 	warn: this is always true.
>
> sound/soc/intel/sst-haswell-ipc.c
>    895                  /* Handle Immediate reply from DSP Core */
>    896                  handled = hsw_process_reply(hsw, ipcx);
>                                   ^^^^^^^^^^^^^^^^^
> Returns 1 on success/error and -EIO on error.
>
>    897
>    898                  if (handled) {
>    899                          /* clear DONE bit - tell DSP we have completed */
>    900                          sst_dsp_shim_update_bits_unlocked(sst, SST_IPCX,
>    901                                  SST_IPCX_DONE, 0);
>    902
>    903                          /* unmask Done interrupt */
>    904                          sst_dsp_shim_update_bits_unlocked(sst, SST_IMRX,
>    905                                  SST_IMRX_DONE, 0);
>    906                  }
>

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
---
 sound/soc/intel/sst-haswell-ipc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown March 7, 2014, 2:51 a.m. UTC | #1
On Thu, Mar 06, 2014 at 02:56:04PM +0000, Liam Girdwood wrote:

> Check the return value for error when processing replies and notifications.

Applied, thanks.

Patch
diff mbox

diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c
index 1f1576a..f46bb4d 100644
--- a/sound/soc/intel/sst-haswell-ipc.c
+++ b/sound/soc/intel/sst-haswell-ipc.c
@@ -895,7 +895,7 @@  static irqreturn_t hsw_irq_thread(int irq, void *context)
 		/* Handle Immediate reply from DSP Core */
 		handled = hsw_process_reply(hsw, ipcx);
 
-		if (handled) {
+		if (handled > 0) {
 			/* clear DONE bit - tell DSP we have completed */
 			sst_dsp_shim_update_bits_unlocked(sst, SST_IPCX,
 				SST_IPCX_DONE, 0);
@@ -913,7 +913,7 @@  static irqreturn_t hsw_irq_thread(int irq, void *context)
 		handled = hsw_process_notification(hsw);
 
 		/* clear BUSY bit and set DONE bit - accept new messages */
-		if (handled) {
+		if (handled > 0) {
 			sst_dsp_shim_update_bits_unlocked(sst, SST_IPCD,
 				SST_IPCD_BUSY | SST_IPCD_DONE, SST_IPCD_DONE);