[Pdbg] [PATCH 12/18] libsbefifo: Use proper cast
Amitay Isaacs
amitay at ozlabs.org
Thu Sep 24 14:42:30 AEST 2020
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
libsbefifo/cmd_control.c | 2 +-
libsbefifo/cmd_scom.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
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);
--
2.26.2
More information about the Pdbg
mailing list