aboutsummaryrefslogtreecommitdiff
path: root/board/CZ.NIC
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2019-04-03 09:12:48 +0200
committerTom Rini <trini@konsulko.com>2019-04-08 09:21:39 -0400
commitccd063e9812a2bdcbeafbbcd8dcb062bfc290f24 (patch)
tree3aa26119f289517fddfc0387279e400938b384d1 /board/CZ.NIC
parentafbc31948a007e03d6a1282677aafc2208f45819 (diff)
downloadu-boot-ccd063e9812a2bdcbeafbbcd8dcb062bfc290f24.zip
u-boot-ccd063e9812a2bdcbeafbbcd8dcb062bfc290f24.tar.gz
u-boot-ccd063e9812a2bdcbeafbbcd8dcb062bfc290f24.tar.bz2
watchdog: Move watchdog_dev to data section (BSS may not be cleared)
This patch moves all instances of static "watchdog_dev" declarations to the "data" section. This may be needed, as the BSS may not be cleared in the early U-Boot phase, where watchdog_reset() is already beeing called. This may result in incorrect pointer access, as the check to "!watchdog_dev" in watchdog_reset() may not be true and the function may continue to run. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Heiko Schocher <hs@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: "Marek BehĂșn" <marek.behun@nic.cz> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Tested-by: Michal Simek <michal.simek@xilinx.com> (on zcu100) Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board/CZ.NIC')
-rw-r--r--board/CZ.NIC/turris_mox/turris_mox.c2
-rw-r--r--board/CZ.NIC/turris_omnia/turris_omnia.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index 65d50a9..96cb9c7 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -120,7 +120,7 @@ int board_fix_fdt(void *blob)
#endif
#ifdef CONFIG_WDT_ARMADA_37XX
-static struct udevice *watchdog_dev;
+static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
void watchdog_reset(void)
{
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index 1f7650c..c7f6479 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -365,7 +365,7 @@ static bool disable_mcu_watchdog(void)
#endif
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
-static struct udevice *watchdog_dev = NULL;
+static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
#endif
int board_init(void)