hikey: fix uninitialized variable in ddr code
authorHaojian Zhuang <haojian.zhuang@linaro.org>
Wed, 31 May 2017 04:42:10 +0000 (12:42 +0800)
committerHaojian Zhuang <haojian.zhuang@linaro.org>
Wed, 31 May 2017 04:42:10 +0000 (12:42 +0800)
Fix uninitliazed variable in ddr driver code.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
plat/hisilicon/hikey/hikey_ddr.c

index 6328eb698881a6c8c5958e9b0bc7c16eae768fe3..ab572eb14bced45a24e0df7cb41f2e970b8ef4e2 100644 (file)
@@ -385,7 +385,7 @@ static void ddrx_rdet(void)
 
 static void ddrx_wdet(void)
 {
-       unsigned int data, wdet, zero_bdl, dq[4];
+       unsigned int data, wdet, zero_bdl = 0, dq[4];
        int i;
 
        data = mmio_read_32((0xf712c000 + 0x0d0));
@@ -454,11 +454,11 @@ static void ddrx_wdet(void)
                for (i = 0; i < 4; i++) {
                        data = mmio_read_32((0xf712c000 + 0x210 + i * 0x80));
                        if ((!(data & 0x1f)) || (!(data & 0x1f00)) ||
-                                       (!(data & 0x1f0000)) || (!(data & 0x1f000000)))
+                           (!(data & 0x1f0000)) || (!(data & 0x1f000000)))
                                zero_bdl = 1;
                        data = mmio_read_32((0xf712c000 + 0x214 + i * 0x80));
                        if ((!(data & 0x1f)) || (!(data & 0x1f00)) ||
-                                       (!(data & 0x1f0000)) || (!(data & 0x1f000000)))
+                           (!(data & 0x1f0000)) || (!(data & 0x1f000000)))
                                zero_bdl = 1;
                        data = mmio_read_32((0xf712c000 + 0x218 + i * 0x80));
                        if (!(data & 0x1f))