NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/40076: zyd(4) cannot be built with -O3



>Number:         40076
>Category:       kern
>Synopsis:       zyd(4) cannot be built with -O3
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 01 11:35:00 +0000 2008
>Originator:     Juan RP
>Release:        Latest
>Organization:
>Environment:
>Description:
The zyd(4) driver cannot be compiled with -O3 currently. There are a
bunch of "use of uninitialized variable" warnings.
>How-To-Repeat:

>Fix:
Index: if_zyd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/if_zyd.c,v
retrieving revision 1.15
diff -b -u -p -r1.15 if_zyd.c
--- if_zyd.c    7 Nov 2008 00:20:13 -0000       1.15
+++ if_zyd.c    1 Dec 2008 11:24:36 -0000
@@ -897,7 +897,7 @@ zyd_rfwrite(struct zyd_softc *sc, uint32
 {
        struct zyd_rf *rf = &sc->sc_rf;
        struct zyd_rfwrite req;
-       uint16_t cr203;
+       uint16_t cr203 = 0;
        int i;
 
        (void)zyd_read16(sc, ZYD_CR203, &cr203);
@@ -916,7 +916,7 @@ zyd_rfwrite(struct zyd_softc *sc, uint32
 Static void
 zyd_lock_phy(struct zyd_softc *sc)
 {
-       uint32_t tmp;
+       uint32_t tmp = 0;
 
        (void)zyd_read32(sc, ZYD_MAC_MISC, &tmp);
        tmp &= ~ZYD_UNLOCK_PHY_REGS;
@@ -926,7 +926,7 @@ zyd_lock_phy(struct zyd_softc *sc)
 Static void
 zyd_unlock_phy(struct zyd_softc *sc)
 {
-       uint32_t tmp;
+       uint32_t tmp = 0;
 
        (void)zyd_read32(sc, ZYD_MAC_MISC, &tmp);
        tmp |= ZYD_UNLOCK_PHY_REGS;
@@ -1177,7 +1177,7 @@ zyd_al2210_init(struct zyd_rf *rf)
        struct zyd_softc *sc = rf->rf_sc;
        static const struct zyd_phy_pair phyini[] = ZYD_AL2210_PHY;
        static const uint32_t rfini[] = ZYD_AL2210_RF;
-       uint32_t tmp;
+       uint32_t tmp = 0;
        int i, error;
 
        (void)zyd_write32(sc, ZYD_CR18, 2);
@@ -1219,7 +1219,7 @@ zyd_al2210_set_channel(struct zyd_rf *rf
 {
        struct zyd_softc *sc = rf->rf_sc;
        static const uint32_t rfprog[] = ZYD_AL2210_CHANTABLE;
-       uint32_t tmp;
+       uint32_t tmp = 0;
 
        (void)zyd_write32(sc, ZYD_CR18, 2);
        (void)zyd_write16(sc, ZYD_CR47, 0x1e);
@@ -1297,7 +1297,7 @@ zyd_maxim_init(struct zyd_rf *rf)
        struct zyd_softc *sc = rf->rf_sc;
        static const struct zyd_phy_pair phyini[] = ZYD_MAXIM_PHY;
        static const uint32_t rfini[] = ZYD_MAXIM_RF;
-       uint16_t tmp;
+       uint16_t tmp = 0;
        int i, error;
 
        /* init RF-dependent PHY registers */
@@ -1339,7 +1339,7 @@ zyd_maxim_set_channel(struct zyd_rf *rf,
        static const struct {
                uint32_t        r1, r2;
        } rfprog[] = ZYD_MAXIM_CHANTABLE;
-       uint16_t tmp;
+       uint16_t tmp = 0;
        int i, error;
 
        /*
@@ -1382,7 +1382,7 @@ zyd_maxim2_init(struct zyd_rf *rf)
        struct zyd_softc *sc = rf->rf_sc;
        static const struct zyd_phy_pair phyini[] = ZYD_MAXIM2_PHY;
        static const uint32_t rfini[] = ZYD_MAXIM2_RF;
-       uint16_t tmp;
+       uint16_t tmp = 0;
        int i, error;
 
        /* init RF-dependent PHY registers */
@@ -1424,7 +1424,7 @@ zyd_maxim2_set_channel(struct zyd_rf *rf
        static const struct {
                uint32_t        r1, r2;
        } rfprog[] = ZYD_MAXIM2_CHANTABLE;
-       uint16_t tmp;
+       uint16_t tmp = 0;
        int i, error;
 
        /*
@@ -1618,8 +1618,8 @@ Static int
 zyd_read_eeprom(struct zyd_softc *sc)
 {
        struct ieee80211com *ic = &sc->sc_ic;
-       uint32_t tmp;
-       uint16_t val;
+       uint32_t tmp = 0;
+       uint16_t val = 0;
        int i;
 
        /* read MAC address */
@@ -1710,7 +1710,7 @@ zyd_switch_radio(struct zyd_softc *sc, i
 Static void
 zyd_set_led(struct zyd_softc *sc, int which, int on)
 {
-       uint32_t tmp;
+       uint32_t tmp = 0;
 
        (void)zyd_read32(sc, ZYD_MAC_TX_PE_CONTROL, &tmp);
        tmp &= ~which;



Home | Main Index | Thread Index | Old Index