diff mbox

[1/3] gbsim: i2s: Fix misuse of header.size which may be endien swapped

Message ID 1428361819-8899-1-git-send-email-john.stultz@linaro.org
State New
Headers show

Commit Message

John Stultz April 6, 2015, 11:10 p.m. UTC
Alex noted I was using header.size, which has been endien swapped,
and I should instead be using the local sz variable instead.

So fix this across the i2s file.

Cc: mark greer <mark.greer@animalcreek.com>
Cc: Alex Elder <alex.elder@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 i2s.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/i2s.c b/i2s.c
index d4d3ce9..9d9f5a1 100644
--- a/i2s.c
+++ b/i2s.c
@@ -62,8 +62,8 @@  void i2s_mgmt_handler(__u8 *rbuf, size_t size)
 		gbsim_debug("Module %d -> AP CPort %d I2S SET_CONFIGURATION response\n  ",
 			    cport_to_module_id(cport_req->cport), cport_rsp->cport);
 		if (verbose)
-			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+			gbsim_dump((__u8 *)op_rsp, sz);
+		write(cport_in, cport_rsp, sz + 1);
 		break;
 	case GB_I2S_MGMT_TYPE_SET_SAMPLES_PER_MESSAGE:
 		sz = sizeof(struct op_header);
@@ -76,8 +76,8 @@  void i2s_mgmt_handler(__u8 *rbuf, size_t size)
 		gbsim_debug("Module %d -> AP CPort %d I2S SET_SAMPLES_PER_MESSAGE response\n  ",
 			    cport_to_module_id(cport_req->cport), cport_rsp->cport);
 		if (verbose)
-			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+			gbsim_dump((__u8 *)op_rsp, sz);
+		write(cport_in, cport_rsp, sz + 1);
 		break;
 	case GB_I2S_MGMT_TYPE_SET_START_DELAY:
 		sz = sizeof(struct op_header);
@@ -90,8 +90,8 @@  void i2s_mgmt_handler(__u8 *rbuf, size_t size)
 		gbsim_debug("Module %d -> AP CPort %d I2S SET_START_DELAY response\n  ",
 			    cport_to_module_id(cport_req->cport), cport_rsp->cport);
 		if (verbose)
-			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+			gbsim_dump((__u8 *)op_rsp, sz);
+		write(cport_in, cport_rsp, sz + 1);
 		break;
 	case GB_I2S_MGMT_TYPE_ACTIVATE_CPORT:
 		sz = sizeof(struct op_header);
@@ -104,8 +104,8 @@  void i2s_mgmt_handler(__u8 *rbuf, size_t size)
 		gbsim_debug("Module %d -> AP CPort %d I2S ACTIVATE_CPORT response\n  ",
 			    cport_to_module_id(cport_req->cport), cport_rsp->cport);
 		if (verbose)
-			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+			gbsim_dump((__u8 *)op_rsp, sz);
+		write(cport_in, cport_rsp, sz + 1);
 		break;
 	case GB_I2S_MGMT_TYPE_DEACTIVATE_CPORT:
 		sz = sizeof(struct op_header);
@@ -118,8 +118,8 @@  void i2s_mgmt_handler(__u8 *rbuf, size_t size)
 		gbsim_debug("Module %d -> AP CPort %d I2S DEACTIVATE_CPORT response\n  ",
 			    cport_to_module_id(cport_req->cport), cport_rsp->cport);
 		if (verbose)
-			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+			gbsim_dump((__u8 *)op_rsp, sz);
+		write(cport_in, cport_rsp, sz + 1);
 		break;
 	default:
 		gbsim_error("i2s mgmt operation type %02x not supported\n", oph->type);
@@ -161,8 +161,8 @@  void i2s_data_handler(__u8 *rbuf, size_t size)
 		gbsim_debug("Module %d -> AP CPort %d I2S SEND_DATA response\n  ",
 			    cport_to_module_id(cport_req->cport), cport_rsp->cport);
 		if (verbose)
-			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+			gbsim_dump((__u8 *)op_rsp, sz);
+		write(cport_in, cport_rsp, sz + 1);
 		break;
 	default:
 		gbsim_error("i2s data operation type %02x not supported\n", oph->type);