summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorQipeng Zha <qipeng.zha@intel.com>2016-01-08 18:32:27 +0800
committerDarren Hart <dvhart@linux.intel.com>2016-01-19 17:35:49 -0800
commit3fae75740faff4c6a66be7131838fda3ae92e280 (patch)
tree742478b6dc378ee25a6ecad69b9f2d41bf6de271 /drivers/platform
parentbb28f3d51ff5e1be541d057708011cc1efe6fae9 (diff)
intel_punit_ipc: add NULL check for input parameters
intel_punit_ipc_command() maybe called when in or out data pointers are NULL. Signed-off-by: Qipeng Zha <qipeng.zha@intel.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/intel_punit_ipc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c
index 16685bc96946..bd875409a02d 100644
--- a/drivers/platform/x86/intel_punit_ipc.c
+++ b/drivers/platform/x86/intel_punit_ipc.c
@@ -187,10 +187,12 @@ int intel_punit_ipc_command(u32 cmd, u32 para1, u32 para2, u32 *in, u32 *out)
reinit_completion(&ipcdev->cmd_complete);
type = (cmd & IPC_PUNIT_CMD_TYPE_MASK) >> IPC_TYPE_OFFSET;
- ipc_write_data_low(ipcdev, type, *in);
- if (type == GTDRIVER_IPC || type == ISPDRIVER_IPC)
- ipc_write_data_high(ipcdev, type, *++in);
+ if (in) {
+ ipc_write_data_low(ipcdev, type, *in);
+ if (type == GTDRIVER_IPC || type == ISPDRIVER_IPC)
+ ipc_write_data_high(ipcdev, type, *++in);
+ }
val = cmd & ~IPC_PUNIT_CMD_TYPE_MASK;
val |= CMD_RUN | para2 << CMD_PARA2_SHIFT | para1 << CMD_PARA1_SHIFT;
@@ -199,10 +201,12 @@ int intel_punit_ipc_command(u32 cmd, u32 para1, u32 para2, u32 *in, u32 *out)
ret = intel_punit_ipc_check_status(ipcdev, type);
if (ret)
goto out;
- *out = ipc_read_data_low(ipcdev, type);
- if (type == GTDRIVER_IPC || type == ISPDRIVER_IPC)
- *++out = ipc_read_data_high(ipcdev, type);
+ if (out) {
+ *out = ipc_read_data_low(ipcdev, type);
+ if (type == GTDRIVER_IPC || type == ISPDRIVER_IPC)
+ *++out = ipc_read_data_high(ipcdev, type);
+ }
out:
mutex_unlock(&ipcdev->lock);