summaryrefslogtreecommitdiff
path: root/drivers/synopsys
diff options
context:
space:
mode:
authorJustin Chadwell <justin.chadwell@arm.com>2019-07-03 14:14:46 +0100
committerJustin Chadwell <justin.chadwell@arm.com>2019-07-12 09:12:19 +0100
commit9264f0876e7b085597c2da9fa850c8e6be1823f8 (patch)
tree694a38efefe01be3bae06a14fd2ccd2d0b6f8d6f /drivers/synopsys
parentdc5baeb3c2d519cc2d9f964dad5f3be1984fb2c2 (diff)
Update synopsys drivers to not rely on undefined overflow behaviour
This consists of ensuring that the left operand of each shift is unsigned when the operation might overflow into the sign bit. Change-Id: I54560fe290e7dc52d364d0fe1c81a16f4c8d9a7b Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
Diffstat (limited to 'drivers/synopsys')
-rw-r--r--drivers/synopsys/emmc/dw_mmc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/synopsys/emmc/dw_mmc.c b/drivers/synopsys/emmc/dw_mmc.c
index b0dcaa73..a063ad05 100644
--- a/drivers/synopsys/emmc/dw_mmc.c
+++ b/drivers/synopsys/emmc/dw_mmc.c
@@ -14,6 +14,7 @@
#include <drivers/delay_timer.h>
#include <drivers/mmc.h>
#include <drivers/synopsys/dw_mmc.h>
+#include <lib/utils_def.h>
#include <lib/mmio.h>
#define DWMMC_CTRL (0x00)
@@ -55,7 +56,7 @@
#define DWMMC_CMDARG (0x28)
#define DWMMC_CMD (0x2c)
-#define CMD_START (1 << 31)
+#define CMD_START (U(1) << 31)
#define CMD_USE_HOLD_REG (1 << 29) /* 0 if SDR50/100 */
#define CMD_UPDATE_CLK_ONLY (1 << 21)
#define CMD_SEND_INIT (1 << 15)
@@ -100,7 +101,7 @@
#define IDMAC_DES0_CH (1 << 4)
#define IDMAC_DES0_ER (1 << 5)
#define IDMAC_DES0_CES (1 << 30)
-#define IDMAC_DES0_OWN (1 << 31)
+#define IDMAC_DES0_OWN (U(1) << 31)
#define IDMAC_DES1_BS1(x) ((x) & 0x1fff)
#define IDMAC_DES2_BS2(x) (((x) & 0x1fff) << 13)