diff mbox series

[v2,14/20] libsbefifo: Use proper cast

Message ID 20201001070814.102735-15-amitay@ozlabs.org
State New
Headers show
Series Add p10 support to libpdbg | expand

Commit Message

Amitay Isaacs Oct. 1, 2020, 7:08 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
---
 libsbefifo/cmd_control.c | 2 +-
 libsbefifo/cmd_scom.c    | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libsbefifo/cmd_control.c b/libsbefifo/cmd_control.c
index 4826b5d..e64f555 100644
--- a/libsbefifo/cmd_control.c
+++ b/libsbefifo/cmd_control.c
@@ -36,7 +36,7 @@  static int sbefifo_istep_execute_push(uint8_t major, uint8_t minor, uint8_t **bu
 
 	cmd = SBEFIFO_CMD_CLASS_CONTROL | SBEFIFO_CMD_EXECUTE_ISTEP;
 
-	step = (major << 16) | minor;
+	step = ((uint32_t)major << 16) | (uint32_t)minor;
 
 	msg[0] = htobe32(nwords);
 	msg[1] = htobe32(cmd);
diff --git a/libsbefifo/cmd_scom.c b/libsbefifo/cmd_scom.c
index 935a00f..db8214d 100644
--- a/libsbefifo/cmd_scom.c
+++ b/libsbefifo/cmd_scom.c
@@ -139,7 +139,7 @@  int sbefifo_scom_put(struct sbefifo_context *sctx, uint64_t addr, uint64_t value
 static int sbefifo_scom_modify_push(uint64_t addr, uint64_t value, uint8_t operand, uint8_t **buf, uint32_t *buflen)
 {
 	uint32_t *msg;
-	uint32_t nwords, cmd;
+	uint32_t nwords, cmd, oper;
 
 	nwords = 7;
 	*buflen = nwords * sizeof(uint32_t);
@@ -149,9 +149,11 @@  static int sbefifo_scom_modify_push(uint64_t addr, uint64_t value, uint8_t opera
 
 	cmd = SBEFIFO_CMD_CLASS_SCOM | SBEFIFO_CMD_MODIFY_SCOM;
 
+	oper = (uint32_t)operand;
+
 	msg[0] = htobe32(nwords);
 	msg[1] = htobe32(cmd);
-	msg[2] = htobe32(operand);
+	msg[2] = htobe32(oper);
 	msg[3] = htobe32(addr >> 32);
 	msg[4] = htobe32(addr & 0xffffffff);
 	msg[5] = htobe32(value >> 32);