From 9e758ef5f877fc62da29acea6a4e429052bd7734 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 20 Dec 2008 21:11:31 +0100 Subject: [PATCH] Eliminate some dead initialization. Found-by: LLVM/Clang Static Analyzer --- sys/bus/iicbus/i386/pcf.c | 1 - sys/dev/disk/trm/trm.c | 2 +- sys/dev/drm/i915_dma.c | 2 +- sys/dev/netif/cx/cx.c | 6 +++--- sys/dev/netif/de/if_de.c | 4 ++-- sys/dev/netif/jme/if_jme.c | 1 - sys/dev/netif/wi/if_wi.c | 2 +- sys/dev/netif/wl/if_wl.c | 2 +- sys/dev/raid/vinum/vinumioctl.c | 2 +- sys/kern/kern_sig.c | 7 +++---- sys/libkern/strtouq.c | 2 +- sys/net/dummynet/ip_dummynet.c | 2 +- sys/net/pf/pf.c | 3 ++- sys/netinet6/mld6.c | 2 +- sys/netproto/ipx/ipx_usrreq.c | 2 +- sys/vfs/ntfs/ntfs_subr.c | 2 +- sys/vfs/nwfs/nwfs_io.c | 2 +- sys/vfs/smbfs/smbfs_io.c | 2 +- 18 files changed, 22 insertions(+), 24 deletions(-) diff --git a/sys/bus/iicbus/i386/pcf.c b/sys/bus/iicbus/i386/pcf.c index f05b9d3ce2..91bf85ed01 100644 --- a/sys/bus/iicbus/i386/pcf.c +++ b/sys/bus/iicbus/i386/pcf.c @@ -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; diff --git a/sys/dev/disk/trm/trm.c b/sys/dev/disk/trm/trm.c index eb6fde35a1..38f6661376 100644 --- a/sys/dev/disk/trm/trm.c +++ b/sys/dev/disk/trm/trm.c @@ -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; diff --git a/sys/dev/drm/i915_dma.c b/sys/dev/drm/i915_dma.c index 6e7be66122..bc82c1589b 100644 --- a/sys/dev/drm/i915_dma.c +++ b/sys/dev/drm/i915_dma.c @@ -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; diff --git a/sys/dev/netif/cx/cx.c b/sys/dev/netif/cx/cx.c index f2baf099c6..f29855a280 100644 --- a/sys/dev/netif/cx/cx.c +++ b/sys/dev/netif/cx/cx.c @@ -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 */ diff --git a/sys/dev/netif/de/if_de.c b/sys/dev/netif/de/if_de.c index 3b974fb638..fb48d3a86d 100644 --- a/sys/dev/netif/de/if_de.c +++ b/sys/dev/netif/de/if_de.c @@ -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; diff --git a/sys/dev/netif/jme/if_jme.c b/sys/dev/netif/jme/if_jme.c index ed1cde6c81..3b85989c54 100644 --- a/sys/dev/netif/jme/if_jme.c +++ b/sys/dev/netif/jme/if_jme.c @@ -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); diff --git a/sys/dev/netif/wi/if_wi.c b/sys/dev/netif/wi/if_wi.c index 34a966db24..2976df9ce9 100644 --- a/sys/dev/netif/wi/if_wi.c +++ b/sys/dev/netif/wi/if_wi.c @@ -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. */ diff --git a/sys/dev/netif/wl/if_wl.c b/sys/dev/netif/wl/if_wl.c index 07bdbb47c4..9c03aa2700 100644 --- a/sys/dev/netif/wl/if_wl.c +++ b/sys/dev/netif/wl/if_wl.c @@ -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; diff --git a/sys/dev/raid/vinum/vinumioctl.c b/sys/dev/raid/vinum/vinumioctl.c index e0b751989f..97cc55b6f4 100644 --- a/sys/dev/raid/vinum/vinumioctl.c +++ b/sys/dev/raid/vinum/vinumioctl.c @@ -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; diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 9104685c5e..b138024bfa 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -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); diff --git a/sys/libkern/strtouq.c b/sys/libkern/strtouq.c index 11db4e9058..789d4f0c31 100644 --- a/sys/libkern/strtouq.c +++ b/sys/libkern/strtouq.c @@ -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; diff --git a/sys/net/dummynet/ip_dummynet.c b/sys/net/dummynet/ip_dummynet.c index 93d91946e4..9e80e7609f 100644 --- a/sys/net/dummynet/ip_dummynet.c +++ b/sys/net/dummynet/ip_dummynet.c @@ -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; diff --git a/sys/net/pf/pf.c b/sys/net/pf/pf.c index 6322b1743d..43abc12b69 100644 --- a/sys/net/pf/pf.c +++ b/sys/net/pf/pf.c @@ -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) { diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 5b8aba4932..ed37233822 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -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; diff --git a/sys/netproto/ipx/ipx_usrreq.c b/sys/netproto/ipx/ipx_usrreq.c index fcda47eca0..0b90a0f584 100644 --- a/sys/netproto/ipx/ipx_usrreq.c +++ b/sys/netproto/ipx/ipx_usrreq.c @@ -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); diff --git a/sys/vfs/ntfs/ntfs_subr.c b/sys/vfs/ntfs/ntfs_subr.c index 1ace1149f2..3f78fd3414 100644 --- a/sys/vfs/ntfs/ntfs_subr.c +++ b/sys/vfs/ntfs/ntfs_subr.c @@ -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; diff --git a/sys/vfs/nwfs/nwfs_io.c b/sys/vfs/nwfs/nwfs_io.c index fc859c7962..42dcfdc1f2 100644 --- a/sys/vfs/nwfs/nwfs_io.c +++ b/sys/vfs/nwfs/nwfs_io.c @@ -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; diff --git a/sys/vfs/smbfs/smbfs_io.c b/sys/vfs/smbfs/smbfs_io.c index a8c3d573be..361f563d5b 100644 --- a/sys/vfs/smbfs/smbfs_io.c +++ b/sys/vfs/smbfs/smbfs_io.c @@ -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); -- 2.11.4.GIT