ASoC: Intel: Skylake: fix typo in sizeof

The size of the pointer to a data structure to send is erroneously
passed to sst_ipc_tx_message_wait() as its tx_bytes argument. It should
be given the size of the pointed skl_ipc_dxstate_info structure instead.

Coincidentally, both the pointer and the structure have the same size of
8 bytes on a 64 bit machine, which "masks" the issue. Compiling for 32
bit reveals the issue more clearly.

Fix the typo for correctness, and to make the code robust to future
evolutions of the skl_ipc_dxstate_info structure size.

This fixes the following coccicheck error:

  sound/soc/intel/skylake/skl-sst-ipc.c:641:8-14: ERROR: application of sizeof to pointer

Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Cc: Jeeja KP <jeeja.kp@intel.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: trivial@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Vincent Stehlé 2015-10-29 23:04:41 +01:00 committed by Mark Brown
parent 677165f76d
commit aaec7e9f78

View file

@ -650,7 +650,7 @@ int skl_ipc_set_dx(struct sst_generic_ipc *ipc, u8 instance_id,
dev_dbg(ipc->dev, "In %s primary =%x ext=%x\n", __func__, dev_dbg(ipc->dev, "In %s primary =%x ext=%x\n", __func__,
header.primary, header.extension); header.primary, header.extension);
ret = sst_ipc_tx_message_wait(ipc, *ipc_header, ret = sst_ipc_tx_message_wait(ipc, *ipc_header,
dx, sizeof(dx), NULL, 0); dx, sizeof(*dx), NULL, 0);
if (ret < 0) { if (ret < 0) {
dev_err(ipc->dev, "ipc: set dx failed, err %d\n", ret); dev_err(ipc->dev, "ipc: set dx failed, err %d\n", ret);
return ret; return ret;