[rtems-libbsd commit] rtemsbsd/arasan_sdhci: Move variable init to start

Joel Sherrill joel at rtems.org
Wed Jan 31 20:00:21 UTC 2024


Module:    rtems-libbsd
Branch:    6-freebsd-12
Commit:    c05a6f545b42123fb43e99b287fc88d76f564a94
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=c05a6f545b42123fb43e99b287fc88d76f564a94

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Tue Jan 23 14:32:47 2024 -0600

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.

---

 rtemsbsd/sys/dev/sdhci/arasan_sdhci.c | 10 ++++++----
 1 file 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");



More information about the vc mailing list