Bug Summary

File:dev/pci/if_ep_pci.c
Warning:line 116, column 2
Value stored to 'i' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple amd64-unknown-openbsd7.4 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name if_ep_pci.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -relaxed-aliasing -ffp-contract=on -fno-rounding-math -mconstructor-aliases -ffreestanding -mcmodel=kernel -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -target-feature -sse2 -target-feature -sse -target-feature -3dnow -target-feature -mmx -target-feature +save-args -target-feature +retpoline-external-thunk -disable-red-zone -no-implicit-float -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/sys/arch/amd64/compile/GENERIC.MP/obj -nostdsysteminc -nobuiltininc -resource-dir /usr/local/llvm16/lib/clang/16 -I /usr/src/sys -I /usr/src/sys/arch/amd64/compile/GENERIC.MP/obj -I /usr/src/sys/arch -I /usr/src/sys/dev/pci/drm/include -I /usr/src/sys/dev/pci/drm/include/uapi -I /usr/src/sys/dev/pci/drm/amd/include/asic_reg -I /usr/src/sys/dev/pci/drm/amd/include -I /usr/src/sys/dev/pci/drm/amd/amdgpu -I /usr/src/sys/dev/pci/drm/amd/display -I /usr/src/sys/dev/pci/drm/amd/display/include -I /usr/src/sys/dev/pci/drm/amd/display/dc -I /usr/src/sys/dev/pci/drm/amd/display/amdgpu_dm -I /usr/src/sys/dev/pci/drm/amd/pm/inc -I /usr/src/sys/dev/pci/drm/amd/pm/legacy-dpm -I /usr/src/sys/dev/pci/drm/amd/pm/swsmu -I /usr/src/sys/dev/pci/drm/amd/pm/swsmu/inc -I /usr/src/sys/dev/pci/drm/amd/pm/swsmu/smu11 -I /usr/src/sys/dev/pci/drm/amd/pm/swsmu/smu12 -I /usr/src/sys/dev/pci/drm/amd/pm/swsmu/smu13 -I /usr/src/sys/dev/pci/drm/amd/pm/powerplay/inc -I /usr/src/sys/dev/pci/drm/amd/pm/powerplay/hwmgr -I /usr/src/sys/dev/pci/drm/amd/pm/powerplay/smumgr -I /usr/src/sys/dev/pci/drm/amd/pm/swsmu/inc -I /usr/src/sys/dev/pci/drm/amd/pm/swsmu/inc/pmfw_if -I /usr/src/sys/dev/pci/drm/amd/display/dc/inc -I /usr/src/sys/dev/pci/drm/amd/display/dc/inc/hw -I /usr/src/sys/dev/pci/drm/amd/display/dc/clk_mgr -I /usr/src/sys/dev/pci/drm/amd/display/modules/inc -I /usr/src/sys/dev/pci/drm/amd/display/modules/hdcp -I /usr/src/sys/dev/pci/drm/amd/display/dmub/inc -I /usr/src/sys/dev/pci/drm/i915 -D DDB -D DIAGNOSTIC -D KTRACE -D ACCOUNTING -D KMEMSTATS -D PTRACE -D POOL_DEBUG -D CRYPTO -D SYSVMSG -D SYSVSEM -D SYSVSHM -D UVM_SWAP_ENCRYPT -D FFS -D FFS2 -D FFS_SOFTUPDATES -D UFS_DIRHASH -D QUOTA -D EXT2FS -D MFS -D NFSCLIENT -D NFSSERVER -D CD9660 -D UDF -D MSDOSFS -D FIFO -D FUSE -D SOCKET_SPLICE -D TCP_ECN -D TCP_SIGNATURE -D INET6 -D IPSEC -D PPP_BSDCOMP -D PPP_DEFLATE -D PIPEX -D MROUTING -D MPLS -D BOOT_CONFIG -D USER_PCICONF -D APERTURE -D MTRR -D NTFS -D SUSPEND -D HIBERNATE -D PCIVERBOSE -D USBVERBOSE -D WSDISPLAY_COMPAT_USL -D WSDISPLAY_COMPAT_RAWKBD -D WSDISPLAY_DEFAULTSCREENS=6 -D X86EMU -D ONEWIREVERBOSE -D MULTIPROCESSOR -D MAXUSERS=80 -D _KERNEL -O2 -Wno-pointer-sign -Wno-address-of-packed-member -Wno-constant-conversion -Wno-unused-but-set-variable -Wno-gnu-folding-constant -fdebug-compilation-dir=/usr/src/sys/arch/amd64/compile/GENERIC.MP/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fcf-protection=branch -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -o /home/ben/Projects/scan/2024-01-11-110808-61670-1 -x c /usr/src/sys/dev/pci/if_ep_pci.c
1/* $OpenBSD: if_ep_pci.c,v 1.37 2023/09/11 08:41:26 mvs Exp $ */
2/* $NetBSD: if_ep_pci.c,v 1.13 1996/10/21 22:56:38 thorpej Exp $ */
3
4/*
5 * Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Herb Peyerl.
19 * 4. The name of Herb Peyerl may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#include "bpfilter.h"
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/mbuf.h>
39#include <sys/socket.h>
40#include <sys/ioctl.h>
41#include <sys/errno.h>
42#include <sys/timeout.h>
43#include <sys/syslog.h>
44#include <sys/device.h>
45
46#include <net/if.h>
47#include <net/if_media.h>
48
49#include <netinet/in.h>
50#include <netinet/if_ether.h>
51
52#if NBPFILTER1 > 0
53#include <net/bpf.h>
54#endif
55
56#include <machine/cpu.h>
57#include <machine/bus.h>
58#include <machine/intr.h>
59
60#include <dev/mii/miivar.h>
61
62#include <dev/ic/elink3var.h>
63#include <dev/ic/elink3reg.h>
64
65#include <dev/pci/pcivar.h>
66#include <dev/pci/pcireg.h>
67#include <dev/pci/pcidevs.h>
68
69/*
70 * PCI constants.
71 * XXX These should be in a common file!
72 */
73#define PCI_CONN0x48 0x48 /* Connector type */
74#define PCI_CBIO0x10 0x10 /* Configuration Base IO Address */
75
76int ep_pci_match(struct device *, void *, void *);
77void ep_pci_attach(struct device *, struct device *, void *);
78
79const struct cfattach ep_pci_ca = {
80 sizeof(struct ep_softc), ep_pci_match, ep_pci_attach
81};
82
83const struct pci_matchid ep_pci_devices[] = {
84 { PCI_VENDOR_3COM0x10b7, PCI_PRODUCT_3COM_3C5900x5900 },
85 { PCI_VENDOR_3COM0x10b7, PCI_PRODUCT_3COM_3C595MII0x5952 },
86 { PCI_VENDOR_3COM0x10b7, PCI_PRODUCT_3COM_3C595T40x5951 },
87 { PCI_VENDOR_3COM0x10b7, PCI_PRODUCT_3COM_3C595TX0x5950 },
88};
89
90int
91ep_pci_match(struct device *parent, void *match, void *aux)
92{
93 return (pci_matchbyid((struct pci_attach_args *)aux, ep_pci_devices,
94 nitems(ep_pci_devices)(sizeof((ep_pci_devices)) / sizeof((ep_pci_devices)[0]))));
95}
96
97void
98ep_pci_attach(struct device *parent, struct device *self, void *aux)
99{
100 struct ep_softc *sc = (void *)self;
101 struct pci_attach_args *pa = aux;
102 pci_chipset_tag_t pc = pa->pa_pc;
103 bus_size_t iosize;
104 pci_intr_handle_t ih;
105 pcireg_t i;
106 const char *intrstr = NULL((void *)0);
107
108 if (pci_mapreg_map(pa, PCI_CBIO0x10, PCI_MAPREG_TYPE_IO0x00000001, 0,
109 &sc->sc_iot, &sc->sc_ioh, NULL((void *)0), &iosize, 0)) {
110 printf(": can't map i/o space\n");
111 return;
112 }
113
114 sc->bustype = EP_BUS_PCI0x3;
115
116 i = pci_conf_read(pc, pa->pa_tag, PCI_CONN0x48);
Value stored to 'i' is never read
117
118 GO_WINDOW(0)((sc->sc_iot)->write_2((sc->sc_ioh), (0x0e), ((u_short
) (0x1<<11)|0)))
;
119
120 printf(":");
121
122 epconfig(sc, EP_CHIPSET_VORTEX0x02, NULL((void *)0));
123
124 /* Map and establish the interrupt. */
125 if (pci_intr_map(pa, &ih)) {
126 printf(", couldn't map interrupt\n");
127 bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize);
128 return;
129 }
130 intrstr = pci_intr_string(pc, ih);
131 sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET0x4, epintr,
132 sc, sc->sc_dev.dv_xname);
133 if (sc->sc_ih == NULL((void *)0)) {
134 printf(": couldn't establish interrupt");
135 if (intrstr != NULL((void *)0))
136 printf(" at %s", intrstr);
137 printf("\n");
138 bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize);
139 return;
140 }
141 printf(" %s\n", intrstr);
142}