Eliminate some dead initialization.
authorSascha Wildner <saw@online.de>
Sat, 20 Dec 2008 20:11:31 +0000 (21:11 +0100)
committerSascha Wildner <saw@online.de>
Sat, 20 Dec 2008 20:11:56 +0000 (21:11 +0100)
Found-by: LLVM/Clang Static Analyzer
18 files changed:
sys/bus/iicbus/i386/pcf.c
sys/dev/disk/trm/trm.c
sys/dev/drm/i915_dma.c
sys/dev/netif/cx/cx.c
sys/dev/netif/de/if_de.c
sys/dev/netif/jme/if_jme.c
sys/dev/netif/wi/if_wi.c
sys/dev/netif/wl/if_wl.c
sys/dev/raid/vinum/vinumioctl.c
sys/kern/kern_sig.c
sys/libkern/strtouq.c
sys/net/dummynet/ip_dummynet.c
sys/net/pf/pf.c
sys/netinet6/mld6.c
sys/netproto/ipx/ipx_usrreq.c
sys/vfs/ntfs/ntfs_subr.c
sys/vfs/nwfs/nwfs_io.c
sys/vfs/smbfs/smbfs_io.c

index f05b9d3..91bf85e 100644 (file)
@@ -142,7 +142,6 @@ pcf_probe(device_t pcfdev)
 
        device_set_desc(pcfdev, "PCF8584 I2C bus controller");
 
-       pcf = DEVTOSOFTC(pcfdev);
        bzero(pcf, sizeof(struct pcf_softc));
 
        pcf->rid_irq = pcf->rid_ioport = 0;
index eb6fde3..38f6661 100644 (file)
@@ -3268,7 +3268,7 @@ NVRAM_trm_write_cmd(PACB pACB, u_int8_t bCmd, u_int8_t bAddr)
 static void
 trm_check_eeprom(PNVRAMTYPE pEEpromBuf, PACB pACB)
 {
-       u_int16_t       *wpEeprom = (u_int16_t *) pEEpromBuf;
+       u_int16_t       *wpEeprom;
        u_int16_t       wAddr, wCheckSum;
        u_long  dAddr, *dpEeprom;
 
index 6e7be66..bc82c15 100644 (file)
@@ -1347,7 +1347,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
 
 int i915_driver_load(struct drm_device *dev, unsigned long flags)
 {
-       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct drm_i915_private *dev_priv;
        unsigned long base, size;
        int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1;
 
index f2baf09..f29855a 100644 (file)
@@ -727,12 +727,12 @@ cxparam (struct tty *tp, struct termios *t)
 void
 cxstop (struct tty *tp, int flag)
 {
-       cx_chan_t *c = cxchan[UNIT(tp->t_dev)];
-       unsigned short port = c->chip->port;
-
        crit_enter();
 
        if (tp->t_state & TS_BUSY) {
+               cx_chan_t *c = cxchan[UNIT(tp->t_dev)];
+               unsigned short port = c->chip->port;
+
                print (("cx%d.%d: cxstop\n", c->board->num, c->num));
 
                /* Set current channel number */
index 3b974fb..fb48d3a 100644 (file)
@@ -1252,7 +1252,7 @@ static void
 tulip_2114x_media_preset(tulip_softc_t *sc)
 {
     const tulip_media_info_t *mi = NULL;
-    tulip_media_t media = sc->tulip_media;
+    tulip_media_t media;
 
     if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE)
        media = sc->tulip_media;
@@ -1489,7 +1489,7 @@ static void
 tulip_21140_cogent_em100_media_probe(tulip_softc_t *sc)
 {
     tulip_media_info_t *mip = sc->tulip_mediainfo;
-    uint32_t cmdmode = TULIP_CSR_READ(sc, csr_command);
+    uint32_t cmdmode;
 
     sc->tulip_gpinit = TULIP_GP_EM100_PINS;
     sc->tulip_gpdata = TULIP_GP_EM100_INIT;
index ed1cde6..3b85989 100644 (file)
@@ -576,7 +576,6 @@ jme_attach(device_t dev)
        sc->jme_dev = dev;
        sc->jme_lowaddr = BUS_SPACE_MAXADDR;
 
-       ifp = &sc->arpcom.ac_if;
        if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 
        callout_init(&sc->jme_tick_ch);
index 34a966d..2976df9 100644 (file)
@@ -1946,7 +1946,7 @@ wi_get_cfg(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *cr)
                        n = (len - off) / reslen;
                len = off + reslen * n;
                if (off != 0) {
-                       struct wi_scan_p2_hdr *p2 = (struct wi_scan_p2_hdr *)wreq.wi_val;
+                       struct wi_scan_p2_hdr *p2;
                        /*
                         * Prepend Prism-specific header.
                         */
index 07bdbb4..9c03aa2 100644 (file)
@@ -2313,7 +2313,7 @@ static void
 wlhdwsleaze(u_short *countp, u_char **mb_pp, struct mbuf **tm_pp)
 {
     struct mbuf        *tm_p = *tm_pp;
-    u_char             *mb_p = *mb_pp;
+    u_char             *mb_p;
     u_short            count = 0;
     u_char             *cp;
     int                len;
index e0b7519..97cc55b 100644 (file)
@@ -75,7 +75,7 @@ vinumioctl(struct dev_ioctl_args *ap)
     struct volume *vol;
     struct partinfo *dpart;
     int fe;                                                /* free list element number */
-    struct _ioctl_reply *ioctl_reply = (struct _ioctl_reply *) data; /* struct to return */
+    struct _ioctl_reply *ioctl_reply;                      /* struct to return */
 
     error = 0;
 
index 9104685..b138024 100644 (file)
@@ -700,13 +700,12 @@ killpg_all_callback(struct proc *p, void *data)
 int
 kern_kill(int sig, pid_t pid, lwpid_t tid)
 {
-       struct thread *td = curthread;
-       struct proc *p = td->td_proc;
-       struct lwp *lp = NULL;
-
        if ((u_int)sig > _SIG_MAXSIG)
                return (EINVAL);
        if (pid > 0) {
+               struct proc *p = curthread->td_proc;
+               struct lwp *lp = NULL;
+
                /* kill single process */
                if ((p = pfind(pid)) == NULL)
                        return (ESRCH);
index 11db4e9..789d4f0 100644 (file)
@@ -51,7 +51,7 @@
 u_quad_t
 strtouq(const char *nptr, char **endptr, int base)
 {
-       const char *s = nptr;
+       const char *s;
        u_quad_t acc;
        unsigned char c;
        u_quad_t qbase, cutoff;
index 93d9194..9e80e76 100644 (file)
@@ -266,7 +266,7 @@ heap_init(struct dn_heap *h, int new_size)
 static int
 heap_insert(struct dn_heap *h, dn_key key1, void *p)
 {
-    int son = h->elements;
+    int son;
 
     if (p == NULL) {   /* Data already there, set starting point */
        son = key1;
index 6322b17..43abc12 100644 (file)
@@ -2490,7 +2490,6 @@ pf_test_tcp(struct pf_rule **rm, struct pf_state **sm, int direction,
        u_short                  reason;
        int                      rewrite = 0;
        int                      tag = -1;
-       u_int16_t                mss = tcp_mssdflt;
 
        r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_FILTER].active.ptr);
 
@@ -2813,6 +2812,8 @@ cleanup:
                        *sm = s;
                if ((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN &&
                    r->keep_state == PF_STATE_SYNPROXY) {
+                       u_int16_t mss = tcp_mssdflt;
+
                        s->src.state = PF_TCPS_PROXY_SRC;
                        if (nr != NULL) {
                                if (direction == PF_OUT) {
index 5b8aba4..ed37233 100644 (file)
@@ -180,7 +180,7 @@ mld6_stop_listening(struct in6_multi *in6m)
 void
 mld6_input(struct mbuf *m, int off)
 {
-       struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
+       struct ip6_hdr *ip6;
        struct mld_hdr *mldh;
        struct ifnet *ifp = m->m_pkthdr.rcvif;
        struct in6_multi *in6m;
index fcda47e..0b90a0f 100644 (file)
@@ -595,7 +595,7 @@ static int
 ripx_attach(struct socket *so, int proto, struct pru_attach_info *ai)
 {
        int error = 0;
-       struct ipxpcb *ipxp = sotoipxpcb(so);
+       struct ipxpcb *ipxp;
 
        if ((error = suser_cred(ai->p_ucred, NULL_CRED_OKAY)) != 0)
                return (error);
index 1ace114..3f78fd3 100644 (file)
@@ -1642,7 +1642,7 @@ ntfs_readattr(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t attrnum,
        if (vap->va_compression && vap->va_compressalg) {
                u_int8_t       *cup;
                u_int8_t       *uup;
-               off_t           off = roff, left = rsize, tocopy;
+               off_t           off, left = rsize, tocopy;
                caddr_t         data = rdata;
                cn_t            cn;
 
index fc859c7..42dcfdc 100644 (file)
@@ -80,7 +80,7 @@ nwfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred)
 {
        struct nwmount *nmp = VTONWFS(vp);
        int error, count, i;
-       struct nwnode *np = VTONW(vp);
+       struct nwnode *np;
        struct nw_entry_info fattr;
        struct vnode *newvp;
        ncpfid fid;
index a8c3d57..361f563 100644 (file)
@@ -84,7 +84,7 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred)
        struct smb_cred scred;
        struct smbfs_fctx *ctx;
        struct vnode *newvp;
-       struct smbnode *np = VTOSMB(vp);
+       struct smbnode *np;
        int error, offset, retval/*, *eofflag = ap->a_eofflag*/;
 
        np = VTOSMB(vp);