NetBSD Problem Report #40076

From www@NetBSD.org  Mon Dec  1 11:33:37 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id A4B8863BD2D
	for <gnats-bugs@gnats.netbsd.org>; Mon,  1 Dec 2008 11:33:37 +0000 (UTC)
Message-Id: <20081201113337.4FFA863B8BD@narn.NetBSD.org>
Date: Mon,  1 Dec 2008 11:33:37 +0000 (UTC)
From: xtraeme@gmail.com
Reply-To: xtraeme@gmail.com
To: gnats-bugs@NetBSD.org
Subject: zyd(4) cannot be built with -O3
X-Send-Pr-Version: www-1.0

>Number:         40076
>Category:       kern
>Synopsis:       zyd(4) cannot be built with -O3
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    maya
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 01 11:35:00 +0000 2008
>Closed-Date:    Sun Dec 04 15:04:44 +0000 2016
>Last-Modified:  Sun Dec 04 15:04:44 +0000 2016
>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;

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->maya
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Sun, 04 Dec 2016 15:04:44 +0000
Responsible-Changed-Why:
taking responsibility for the following...


State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 04 Dec 2016 15:04:44 +0000
State-Changed-Why:
based on the code in its *current* state, it is initialized fine.
this mgiht not have been true in the past, but it is now.
even if it fails to compile with -O3, I don't think bogus warnings in non-standard compile options is something we want to fix.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.