aboutsummaryrefslogtreecommitdiff
path: root/drivers/renesas/rcar
diff options
context:
space:
mode:
authorJustin Chadwell <justin.chadwell@arm.com>2019-07-03 14:11:06 +0100
committerJustin Chadwell <justin.chadwell@arm.com>2019-07-11 12:10:58 +0100
commit673406b50841ca45b3f041283a0d5f750611470e (patch)
tree2eafbdba170f898f48ab80f47604d76106538f1e /drivers/renesas/rcar
parent1578169edd4aec236e564570c73a931ad632e420 (diff)
downloadtrusted-firmware-a-673406b50841ca45b3f041283a0d5f750611470e.tar.gz
Update renesas platform 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: I51278beacbe6da79853c3f0f0f94cd806fc9652c Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
Diffstat (limited to 'drivers/renesas/rcar')
-rw-r--r--drivers/renesas/rcar/cpld/ulcb_cpld.c2
-rw-r--r--drivers/renesas/rcar/pwrc/pwrc.c6
-rw-r--r--drivers/renesas/rcar/pwrc/pwrc.h2
3 files changed, 5 insertions, 5 deletions
diff --git a/drivers/renesas/rcar/cpld/ulcb_cpld.c b/drivers/renesas/rcar/cpld/ulcb_cpld.c
index 4830853739..5ffb2e1971 100644
--- a/drivers/renesas/rcar/cpld/ulcb_cpld.c
+++ b/drivers/renesas/rcar/cpld/ulcb_cpld.c
@@ -68,7 +68,7 @@ static void cpld_write(uint8_t addr, uint32_t data)
for (i = 0; i < 32; i++) {
/* MSB first */
- gpio_set_value(GPIO_OUTDT6, MOSI, data & (1 << 31));
+ gpio_set_value(GPIO_OUTDT6, MOSI, data & (1U << 31));
gpio_set_value(GPIO_OUTDT6, SCLK, 1);
data <<= 1;
gpio_set_value(GPIO_OUTDT6, SCLK, 0);
diff --git a/drivers/renesas/rcar/pwrc/pwrc.c b/drivers/renesas/rcar/pwrc/pwrc.c
index d97e593bbd..f4c9d3abcb 100644
--- a/drivers/renesas/rcar/pwrc/pwrc.c
+++ b/drivers/renesas/rcar/pwrc/pwrc.c
@@ -763,10 +763,10 @@ uint32_t rcar_pwrc_get_cluster(void)
reg = mmio_read_32(RCAR_PRR);
- if (reg & (1 << (STATE_CA53_CPU + RCAR_CA53CPU_NUM_MAX)))
+ if (reg & (1U << (STATE_CA53_CPU + RCAR_CA53CPU_NUM_MAX)))
return RCAR_CLUSTER_CA57;
- if (reg & (1 << (STATE_CA57_CPU + RCAR_CA57CPU_NUM_MAX)))
+ if (reg & (1U << (STATE_CA57_CPU + RCAR_CA57CPU_NUM_MAX)))
return RCAR_CLUSTER_CA53;
return RCAR_CLUSTER_A53A57;
@@ -810,7 +810,7 @@ uint32_t rcar_pwrc_get_cpu_num(uint32_t c)
count_ca57:
if (IS_A53A57(c) || IS_CA57(c)) {
- if (reg & (1 << (STATE_CA57_CPU + RCAR_CA57CPU_NUM_MAX)))
+ if (reg & (1U << (STATE_CA57_CPU + RCAR_CA57CPU_NUM_MAX)))
goto done;
for (i = 0; i < RCAR_CA57CPU_NUM_MAX; i++) {
diff --git a/drivers/renesas/rcar/pwrc/pwrc.h b/drivers/renesas/rcar/pwrc/pwrc.h
index cfb35ff923..e67c6ef2d6 100644
--- a/drivers/renesas/rcar/pwrc/pwrc.h
+++ b/drivers/renesas/rcar/pwrc/pwrc.h
@@ -15,7 +15,7 @@
#define PWKUPR_WEN (1ull << 31)
-#define PSYSR_AFF_L2 (1 << 31)
+#define PSYSR_AFF_L2 (1U << 31)
#define PSYSR_AFF_L1 (1 << 30)
#define PSYSR_AFF_L0 (1 << 29)
#define PSYSR_WEN (1 << 28)