diff options
author | Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> | 2013-11-14 17:15:06 -0500 |
---|---|---|
committer | Matthew Garrett <matthew.garrett@nebula.com> | 2013-11-20 18:51:28 -0500 |
commit | c7094d1d994c23950d8a55d33dcb7ed6d9b13f8f (patch) | |
tree | 58ed7f75c0b0a656133e9ab5d11672eed8e17385 | |
parent | 7f95afb317d94f383877e67dc52fda17dc37fa21 (diff) |
ipc: Handle error conditions in ipc command
Handle error conditions in intel_scu_ipc_command() and
pwr_reg_rdwr().
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
-rw-r--r-- | drivers/platform/x86/intel_scu_ipc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c index 86b6ce2a7a47..e26830f6c8dd 100644 --- a/drivers/platform/x86/intel_scu_ipc.c +++ b/drivers/platform/x86/intel_scu_ipc.c | |||
@@ -235,7 +235,7 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id) | |||
235 | } | 235 | } |
236 | 236 | ||
237 | err = busy_loop(); | 237 | err = busy_loop(); |
238 | if (id == IPC_CMD_PCNTRL_R) { /* Read rbuf */ | 238 | if (!err && id == IPC_CMD_PCNTRL_R) { /* Read rbuf */ |
239 | /* Workaround: values are read as 0 without memcpy_fromio */ | 239 | /* Workaround: values are read as 0 without memcpy_fromio */ |
240 | memcpy_fromio(cbuf, ipcdev.ipc_base + 0x90, 16); | 240 | memcpy_fromio(cbuf, ipcdev.ipc_base + 0x90, 16); |
241 | for (nc = 0; nc < count; nc++) | 241 | for (nc = 0; nc < count; nc++) |
@@ -465,8 +465,10 @@ int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, | |||
465 | ipc_command((inlen << 16) | (sub << 12) | cmd); | 465 | ipc_command((inlen << 16) | (sub << 12) | cmd); |
466 | err = busy_loop(); | 466 | err = busy_loop(); |
467 | 467 | ||
468 | for (i = 0; i < outlen; i++) | 468 | if (!err) { |
469 | *out++ = ipc_data_readl(4 * i); | 469 | for (i = 0; i < outlen; i++) |
470 | *out++ = ipc_data_readl(4 * i); | ||
471 | } | ||
470 | 472 | ||
471 | mutex_unlock(&ipclock); | 473 | mutex_unlock(&ipclock); |
472 | return err; | 474 | return err; |