drivers/*: mark variables with uninitialized_var()
authorJeff Garzik <jeff@garzik.org>
Tue, 17 Jul 2007 09:39:58 +0000 (05:39 -0400)
committerJeff Garzik <jeff@garzik.org>
Tue, 17 Jul 2007 20:23:19 +0000 (16:23 -0400)
Mark variables in drivers/* with uninitialized_var() if such a warning
appears, and analysis proves that the var is initialized properly on all
paths it is used.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/atm/zatm.c
drivers/char/cyclades.c
drivers/mtd/ubi/eba.c
drivers/net/r8169.c
drivers/net/tokenring/smctr.c
drivers/usb/misc/auerswald.c
drivers/video/matrox/matroxfb_maven.c
drivers/video/riva/riva_hw.c

index 020a87a476c813945d1f1f1ffc55c398704dc502..58583c6ac5be556f1297ae0353e1f5b95dc56d17 100644 (file)
@@ -915,7 +915,7 @@ static int open_tx_first(struct atm_vcc *vcc)
        unsigned long flags;
        u32 *loop;
        unsigned short chan;
-       int pcr,unlimited;
+       int unlimited;
 
        DPRINTK("open_tx_first\n");
        zatm_dev = ZATM_DEV(vcc->dev);
@@ -936,6 +936,8 @@ static int open_tx_first(struct atm_vcc *vcc)
            vcc->qos.txtp.max_pcr >= ATM_OC3_PCR);
        if (unlimited && zatm_dev->ubr != -1) zatm_vcc->shaper = zatm_dev->ubr;
        else {
+               int uninitialized_var(pcr);
+
                if (unlimited) vcc->qos.txtp.max_sdu = ATM_MAX_AAL5_PDU;
                if ((zatm_vcc->shaper = alloc_shaper(vcc->dev,&pcr,
                    vcc->qos.txtp.min_pcr,vcc->qos.txtp.max_pcr,unlimited))
index 7b0839426e189a05dd179c27f3cb090113f95d2e..9e0adfe27c12d56cf8d36515f0c6061a47db4a8a 100644 (file)
@@ -4466,10 +4466,10 @@ static void cy_hangup(struct tty_struct *tty)
 static int __devinit cy_init_card(struct cyclades_card *cinfo)
 {
        struct cyclades_port *info;
-       u32 mailbox;
+       u32 uninitialized_var(mailbox);
        unsigned int nports;
        unsigned short chip_number;
-       int index, port;
+       int uninitialized_var(index), port;
 
        spin_lock_init(&cinfo->card_lock);
 
index 4dc10c8ab964fd4acf9b9ccdc002172ddc0c4062..7c6b223b3f8a0a22b114a5b593f1ad605b85fcc5 100644 (file)
@@ -368,7 +368,7 @@ int ubi_eba_read_leb(struct ubi_device *ubi, int vol_id, int lnum, void *buf,
        int err, pnum, scrub = 0, idx = vol_id2idx(ubi, vol_id);
        struct ubi_vid_hdr *vid_hdr;
        struct ubi_volume *vol = ubi->volumes[idx];
-       uint32_t crc;
+       uint32_t uninitialized_var(crc);
 
        err = leb_read_lock(ubi, vol_id, lnum);
        if (err)
index 982a9010c7a925e0b2e29b14cbe156d670c57d2b..bb6896ae31517c46b098dafcf1f35a28232112b3 100644 (file)
@@ -2338,7 +2338,7 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb,
 {
        struct skb_shared_info *info = skb_shinfo(skb);
        unsigned int cur_frag, entry;
-       struct TxDesc *txd;
+       struct TxDesc * uninitialized_var(txd);
 
        entry = tp->cur_tx;
        for (cur_frag = 0; cur_frag < info->nr_frags; cur_frag++) {
index 58d7e5d452fa7fdae1979ab96aac45213da7d026..f83bb5cb0d3d84e42e428365ee8e98da26369d80 100644 (file)
@@ -3692,7 +3692,6 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
         __u16 rcode, correlator;
         int err = 0;
         __u8 xframe = 1;
-        __u16 tx_fstatus;
 
         rmf->vl = SWAP_BYTES(rmf->vl);
         if(rx_status & FCB_RX_STATUS_DA_MATCHED)
@@ -3783,7 +3782,9 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
                                 }
                                 break;
 
-                        case TX_FORWARD:
+                        case TX_FORWARD: {
+                               __u16 uninitialized_var(tx_fstatus);
+
                                 if((rcode = smctr_rcv_tx_forward(dev, rmf))
                                         != POSITIVE_ACK)
                                 {
@@ -3811,6 +3812,7 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
                                         }
                                 }
                                 break;
+                       }
 
                         /* Received MAC Frames Processed by CRS/REM/RPS. */
                         case RSP:
index 3e22b2ff9e7406aa0c5b170efb814cd183f07450..42d4e6454a77f3bfec9562bc41b44a85ab42afb8 100644 (file)
@@ -664,7 +664,7 @@ static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsi
        int ret;
        struct usb_ctrlrequest *dr;
        struct urb *urb;
-        int length;
+        int uninitialized_var(length);
 
         dbg ("auerchain_control_msg");
         dr = kmalloc (sizeof (struct usb_ctrlrequest), GFP_KERNEL);
index 5d29a26b8cdf39aadd6b59a27877b0e82b75e4e9..de0d755f901924fb439f54f8f964796ce80fa78c 100644 (file)
@@ -273,8 +273,11 @@ static int matroxfb_PLL_mavenclock(const struct matrox_pll_features2* pll,
                        }
                }
        }
+
+       /* if h2/post/in/feed have not been assigned, return zero (error) */
        if (besth2 < 2)
                return 0;
+
        dprintk(KERN_ERR "clk: %02X %02X %02X %d %d\n", *in, *feed, *post, fxtal, fwant);
        return fxtal * (*feed) / (*in) * ctl->den;
 }
@@ -284,7 +287,7 @@ static unsigned int matroxfb_mavenclock(const struct matrox_pll_ctl* ctl,
                unsigned int* in, unsigned int* feed, unsigned int* post,
                unsigned int* htotal2) {
        unsigned int fvco;
-       unsigned int p;
+       unsigned int uninitialized_var(p);
 
        fvco = matroxfb_PLL_mavenclock(&maven1000_pll, ctl, htotal, vtotal, in, feed, &p, htotal2);
        if (!fvco)
@@ -715,7 +718,9 @@ static int maven_find_exact_clocks(unsigned int ht, unsigned int vt,
        m->regs[0x82] = 0x81;
 
        for (x = 0; x < 8; x++) {
-               unsigned int a, b, c, h2;
+               unsigned int c;
+               unsigned int uninitialized_var(a), uninitialized_var(b),
+                            uninitialized_var(h2);
                unsigned int h = ht + 2 + x;
 
                if (!matroxfb_mavenclock((m->mode == MATROXFB_OUTPUT_MODE_PAL) ? &maven_PAL : &maven_NTSC, h, vt, &a, &b, &c, &h2)) {
index 70bfd78eca819a873ee35932e650bafb58d4b423..13307703a9f04d421792a460b8b595c50ee776f6 100644 (file)
@@ -1223,6 +1223,8 @@ static int CalcVClock
         }
     }
     }
+
+    /* non-zero: M/N/P/clock values assigned.  zero: error (not set) */
     return (DeltaOld != 0xFFFFFFFF);
 }
 /*
@@ -1240,7 +1242,10 @@ int CalcStateExt
     int            dotClock
 )
 {
-    int pixelDepth, VClk, m, n, p;
+    int pixelDepth;
+    int uninitialized_var(VClk),uninitialized_var(m),
+        uninitialized_var(n),  uninitialized_var(p);
+
     /*
      * Save mode parameters.
      */