summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKinsey Moore <kinsey.moore@oarcorp.com>2024-01-23 14:32:47 -0600
committerJoel Sherrill <joel@rtems.org>2024-01-31 14:00:17 -0600
commitc05a6f545b42123fb43e99b287fc88d76f564a94 (patch)
treee991ea806240995913e2c6dae52944e58a2de171
parentrtemsbsd/rtems: Don't leak memory on error (diff)
downloadrtems-libbsd-c05a6f545b42123fb43e99b287fc88d76f564a94.tar.bz2
rtemsbsd/arasan_sdhci: Move variable init to start
This moves the ZynqMP-specific variable initialization to the start of the function to avoid Coverity warnings.
-rw-r--r--rtemsbsd/sys/dev/sdhci/arasan_sdhci.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/rtemsbsd/sys/dev/sdhci/arasan_sdhci.c b/rtemsbsd/sys/dev/sdhci/arasan_sdhci.c
index 722e609d..017f4acb 100644
--- a/rtemsbsd/sys/dev/sdhci/arasan_sdhci.c
+++ b/rtemsbsd/sys/dev/sdhci/arasan_sdhci.c
@@ -247,6 +247,12 @@ arasan_sdhci_attach(device_t dev)
{
struct arasan_sdhci_softc *sc = device_get_softc(dev);
int rid, err;
+#if defined(LIBBSP_AARCH64_XILINX_ZYNQMP_BSP_H)
+ volatile uint32_t *RST_LPD_IOU2_ptr = (uint32_t*)0xFF5E0238;
+ uint32_t RST_LPD_IOU2 = *RST_LPD_IOU2_ptr;
+ uint32_t SDIO0_disabled = RST_LPD_IOU2 & (1 << 5);
+ uint32_t SDIO1_disabled = RST_LPD_IOU2 & (1 << 6);
+#endif
sc->dev = dev;
@@ -265,10 +271,6 @@ arasan_sdhci_attach(device_t dev)
* Detect this situation and avoid probing the device in this situation.
*/
#if defined(LIBBSP_AARCH64_XILINX_ZYNQMP_BSP_H)
- volatile uint32_t *RST_LPD_IOU2_ptr = (uint32_t*)0xFF5E0238;
- uint32_t RST_LPD_IOU2 = *RST_LPD_IOU2_ptr;
- uint32_t SDIO0_disabled = RST_LPD_IOU2 & (1 << 5);
- uint32_t SDIO1_disabled = RST_LPD_IOU2 & (1 << 6);
if ( sc->mem_res == 0xFF160000 ) {
if ( SDIO0_disabled != 0 ) {
device_printf(dev, "SDIO0 disabled\n");