Do pass removing some write-only variables from the kernel.

This reduces noise when kernel is compiled by newer GCC versions,
such as one used by external toolchain ports.

Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial)
Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c)
Differential Revision: https://reviews.freebsd.org/D10385
This commit is contained in:
Alexander Kabaev 2017-12-25 04:48:39 +00:00
parent 280d15cd0a
commit 151ba7933a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327173
84 changed files with 68 additions and 313 deletions

View file

@ -115,9 +115,6 @@ static void aw_wdog_shutdown_fn(void *, int);
static int
aw_wdog_probe(device_t dev)
{
struct aw_wdog_softc *sc;
sc = device_get_softc(dev);
if (!ofw_bus_status_okay(dev))
return (ENXIO);

View file

@ -352,13 +352,11 @@ axp81x_shutdown(void *devp, int howto)
static void
axp81x_intr(void *arg)
{
struct axp81x_softc *sc;
device_t dev;
uint8_t val;
int error;
dev = arg;
sc = device_get_softc(dev);
error = axp81x_read(dev, AXP_IRQSTAT5, &val, 1);
if (error != 0)

View file

@ -865,7 +865,7 @@ h3_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
int flags)
{
struct aw_pll_factor *f;
uint32_t val, n, k, m, p;
uint32_t val, m, p;
int i;
f = NULL;
@ -884,8 +884,6 @@ h3_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
DEVICE_LOCK(sc);
PLL_READ(sc, &val);
n = (val & A23_PLL1_FACTOR_N) >> A23_PLL1_FACTOR_N_SHIFT;
k = (val & A23_PLL1_FACTOR_K) >> A23_PLL1_FACTOR_K_SHIFT;
m = (val & A23_PLL1_FACTOR_M) >> A23_PLL1_FACTOR_M_SHIFT;
p = (val & A23_PLL1_FACTOR_P) >> A23_PLL1_FACTOR_P_SHIFT;

View file

@ -1266,12 +1266,10 @@ awg_setup_extres(device_t dev)
hwreset_t rst_ahb, rst_ephy;
clk_t clk_ahb, clk_ephy;
regulator_t reg;
phandle_t node;
uint64_t freq;
int error, div;
sc = device_get_softc(dev);
node = ofw_bus_get_node(dev);
rst_ahb = rst_ephy = NULL;
clk_ahb = clk_ephy = NULL;
reg = NULL;
@ -1713,13 +1711,11 @@ awg_attach(device_t dev)
{
uint8_t eaddr[ETHER_ADDR_LEN];
struct awg_softc *sc;
phandle_t node;
int error;
sc = device_get_softc(dev);
sc->dev = dev;
sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
node = ofw_bus_get_node(dev);
if (bus_alloc_resources(dev, awg_spec, sc->res) != 0) {
device_printf(dev, "cannot allocate resources for device\n");

View file

@ -1384,11 +1384,9 @@ int
arm_gicv2m_attach(device_t dev)
{
struct arm_gicv2m_softc *sc;
struct arm_gic_softc *psc;
uint32_t typer;
int rid;
psc = device_get_softc(device_get_parent(dev));
sc = device_get_softc(dev);
rid = 0;

View file

@ -1386,9 +1386,6 @@ bcm2835_cpufreq_attach(device_t dev)
static int
bcm2835_cpufreq_detach(device_t dev)
{
struct bcm2835_cpufreq_softc *sc;
sc = device_get_softc(dev);
sema_destroy(&vc_sema);
@ -1400,7 +1397,10 @@ bcm2835_cpufreq_set(device_t dev, const struct cf_setting *cf)
{
struct bcm2835_cpufreq_softc *sc;
uint32_t rate_hz, rem;
int cur_freq, resp_freq, arm_freq, min_freq, core_freq;
int resp_freq, arm_freq, min_freq, core_freq;
#ifdef DEBUG
int cur_freq;
#endif
if (cf == NULL || cf->freq < 0)
return (EINVAL);
@ -1425,8 +1425,10 @@ bcm2835_cpufreq_set(device_t dev, const struct cf_setting *cf)
/* set new value and verify it */
VC_LOCK(sc);
#ifdef DEBUG
cur_freq = bcm2835_cpufreq_get_clock_rate(sc,
BCM2835_MBOX_CLOCK_ID_ARM);
#endif
resp_freq = bcm2835_cpufreq_set_clock_rate(sc,
BCM2835_MBOX_CLOCK_ID_ARM, rate_hz);
DELAY(TRANSITION_LATENCY);

View file

@ -1017,7 +1017,7 @@ bcm_gpio_pic_map_fdt(struct bcm_gpio_softc *sc, struct intr_map_data_fdt *daf,
u_int *irqp, uint32_t *modep)
{
u_int irq;
uint32_t mode, bank;
uint32_t mode;
/*
* The first cell is the interrupt number.
@ -1036,7 +1036,6 @@ bcm_gpio_pic_map_fdt(struct bcm_gpio_softc *sc, struct intr_map_data_fdt *daf,
return (EINVAL);
/* Only reasonable modes are supported. */
bank = BCM_GPIO_BANK(irq);
if (daf->cells[1] == 1)
mode = GPIO_INTR_EDGE_RISING;
else if (daf->cells[1] == 2)

View file

@ -103,14 +103,18 @@ static struct ofw_compat_data compat_data[] = {
static int
bcm_mbox_read_msg(struct bcm_mbox_softc *sc, int *ochan)
{
#ifdef DEBUG
uint32_t data;
#endif
uint32_t msg;
int chan;
msg = mbox_read_4(sc, REG_READ);
dprintf("bcm_mbox_intr: raw data %08x\n", msg);
chan = MBOX_CHAN(msg);
#ifdef DEBUG
data = MBOX_DATA(msg);
#endif
if (sc->msg[chan]) {
printf("bcm_mbox_intr: channel %d oveflow\n", chan);
return (1);

View file

@ -408,9 +408,7 @@ arm_gic_v3_intr(void *arg)
struct intr_pic *pic;
uint64_t active_irq;
struct trapframe *tf;
bool first;
first = true;
pic = sc->gic_pic;
while (1) {

View file

@ -1105,12 +1105,10 @@ static int
gicv3_its_release_msi(device_t dev, device_t child, int count,
struct intr_irqsrc **isrc)
{
struct gicv3_its_softc *sc;
struct gicv3_its_irqsrc *girq;
struct its_dev *its_dev;
int i;
sc = device_get_softc(dev);
its_dev = its_device_find(dev, child);
KASSERT(its_dev != NULL,
@ -1165,11 +1163,9 @@ gicv3_its_alloc_msix(device_t dev, device_t child, device_t *pic,
static int
gicv3_its_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc)
{
struct gicv3_its_softc *sc;
struct gicv3_its_irqsrc *girq;
struct its_dev *its_dev;
sc = device_get_softc(dev);
its_dev = its_device_find(dev, child);
KASSERT(its_dev != NULL,
@ -1405,9 +1401,7 @@ its_cmd_prepare(struct its_cmd *cmd, struct its_cmd_desc *desc)
uint64_t target;
uint8_t cmd_type;
u_int size;
boolean_t error;
error = FALSE;
cmd_type = desc->cmd_type;
target = ITS_TARGET_NONE;

View file

@ -630,14 +630,13 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
struct sigframe *fp, frame;
struct sigacts *psp;
struct sysentvec *sysent;
int code, onstack, sig;
int onstack, sig;
td = curthread;
p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
sig = ksi->ksi_signo;
code = ksi->ksi_code;
psp = p->p_sigacts;
mtx_assert(&psp->ps_mtx, MA_OWNED);

View file

@ -621,7 +621,7 @@ pmap_bootstrap_l2(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l2_start)
static vm_offset_t
pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l3_start)
{
vm_offset_t l2pt, l3pt;
vm_offset_t l3pt;
vm_paddr_t pa;
pd_entry_t *l2;
u_int l2_slot;
@ -630,7 +630,6 @@ pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l3_start)
l2 = pmap_l2(kernel_pmap, va);
l2 = (pd_entry_t *)rounddown2((uintptr_t)l2, PAGE_SIZE);
l2pt = (vm_offset_t)l2;
l2_slot = pmap_l2_index(va);
l3pt = l3_start;

View file

@ -2631,10 +2631,8 @@ adaprobedone(struct cam_periph *periph, union ccb *ccb)
static void
adazonedone(struct cam_periph *periph, union ccb *ccb)
{
struct ada_softc *softc;
struct bio *bp;
softc = periph->softc;
bp = (struct bio *)ccb->ccb_h.ccb_bp;
switch (bp->bio_zone.zone_cmd) {
@ -2649,7 +2647,7 @@ adazonedone(struct cam_periph *periph, union ccb *ccb)
struct scsi_report_zones_hdr *hdr;
struct scsi_report_zones_desc *desc;
struct disk_zone_rep_entry *entry;
uint32_t num_alloced, hdr_len, num_avail;
uint32_t hdr_len, num_avail;
uint32_t num_to_fill, i;
rep = &bp->bio_zone.zone_params.report;
@ -2664,7 +2662,6 @@ adazonedone(struct cam_periph *periph, union ccb *ccb)
* be different than the amount of data transferred to
* the user.
*/
num_alloced = rep->entries_allocated;
hdr = (struct scsi_report_zones_hdr *)ccb->ataio.data_ptr;
if (avail_len < sizeof(*hdr)) {
/*

View file

@ -1525,7 +1525,6 @@ daclose(struct disk *dp)
struct cam_periph *periph;
struct da_softc *softc;
union ccb *ccb;
int error;
periph = (struct cam_periph *)dp->d_drv1;
softc = (struct da_softc *)periph->softc;
@ -1544,7 +1543,7 @@ daclose(struct disk *dp)
/*cbfcnp*/dadone, MSG_SIMPLE_Q_TAG,
/*begin_lba*/0, /*lb_count*/0, SSD_FULL_SIZE,
5 * 60 * 1000);
error = cam_periph_runccb(ccb, daerror, /*cam_flags*/0,
cam_periph_runccb(ccb, daerror, /*cam_flags*/0,
/*sense_flags*/SF_RETRY_UA | SF_QUIET_IR,
softc->disk->d_devstat);
softc->flags &= ~DA_FLAG_DIRTY;
@ -2311,7 +2310,7 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS)
char buf[16];
const char *p;
struct da_softc *softc;
int i, error, methods, value;
int i, error, value;
softc = (struct da_softc *)arg1;
@ -2324,7 +2323,6 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS)
error = sysctl_handle_string(oidp, buf, sizeof(buf), req);
if (error != 0 || req->newptr == NULL)
return (error);
methods = softc->delete_available | (1 << DA_DELETE_DISABLE);
for (i = 0; i <= DA_DELETE_MAX; i++) {
if (strcmp(buf, da_delete_method_names[i]) == 0)
break;
@ -3970,7 +3968,7 @@ dazonedone(struct cam_periph *periph, union ccb *ccb)
struct scsi_report_zones_hdr *hdr;
struct scsi_report_zones_desc *desc;
struct disk_zone_rep_entry *entry;
uint32_t num_alloced, hdr_len, num_avail;
uint32_t hdr_len, num_avail;
uint32_t num_to_fill, i;
int ata;
@ -3987,7 +3985,6 @@ dazonedone(struct cam_periph *periph, union ccb *ccb)
* the user.
*/
bp->bio_resid = ccb->csio.resid;
num_alloced = rep->entries_allocated;
hdr = (struct scsi_report_zones_hdr *)ccb->csio.data_ptr;
if (avail_len < sizeof(*hdr)) {
/*

View file

@ -1699,13 +1699,11 @@ static int
passmemdone(struct cam_periph *periph, struct pass_io_req *io_req)
{
struct pass_softc *softc;
union ccb *ccb;
int error;
int i;
error = 0;
softc = (struct pass_softc *)periph->softc;
ccb = &io_req->ccb;
switch (io_req->data_flags) {
case CAM_DATA_VADDR:

View file

@ -272,7 +272,6 @@ al_probe(device_t dev)
static int
al_attach(device_t dev)
{
struct al_eth_lm_context *lm_context;
struct al_eth_adapter *adapter;
struct sysctl_oid_list *child;
struct sysctl_ctx_list *ctx;
@ -305,8 +304,6 @@ al_attach(device_t dev)
g_adapters[g_adapters_count] = adapter;
lm_context = &adapter->lm_context;
bar_udma = PCIR_BAR(AL_ETH_UDMA_BAR);
adapter->udma_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
&bar_udma, RF_ACTIVE);

View file

@ -954,7 +954,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
struct xgbe_packet_data *packet;
struct ifnet *ifp = pdata->netdev;
struct mbuf *m;
unsigned int incomplete, context_next, context;
unsigned int incomplete, context_next;
unsigned int received = 0;
int packet_count = 0;
@ -992,9 +992,6 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
context_next = XGMAC_GET_BITS(packet->attributes,
RX_PACKET_ATTRIBUTES,
CONTEXT_NEXT);
context = XGMAC_GET_BITS(packet->attributes,
RX_PACKET_ATTRIBUTES,
CONTEXT);
/* Earlier error, just drain the remaining data */
if (incomplete || context_next) {

View file

@ -752,36 +752,30 @@ static void xgbe_an_init(struct xgbe_prv_data *pdata)
static void xgbe_phy_adjust_link(struct xgbe_prv_data *pdata)
{
int new_state = 0;
if (pdata->phy.link) {
/* Flow control support */
pdata->pause_autoneg = pdata->phy.pause_autoneg;
if (pdata->tx_pause != pdata->phy.tx_pause) {
new_state = 1;
pdata->hw_if.config_tx_flow_control(pdata);
pdata->tx_pause = pdata->phy.tx_pause;
}
if (pdata->rx_pause != pdata->phy.rx_pause) {
new_state = 1;
pdata->hw_if.config_rx_flow_control(pdata);
pdata->rx_pause = pdata->phy.rx_pause;
}
/* Speed support */
if (pdata->phy_speed != pdata->phy.speed) {
new_state = 1;
pdata->phy_speed = pdata->phy.speed;
}
if (pdata->phy_link != pdata->phy.link) {
new_state = 1;
pdata->phy_link = pdata->phy.link;
}
} else if (pdata->phy_link) {
new_state = 1;
pdata->phy_link = 0;
pdata->phy_speed = SPEED_UNKNOWN;
}

View file

@ -237,7 +237,7 @@ igb_isc_txd_encap(void *arg, if_pkt_info_t pi)
int nsegs = pi->ipi_nsegs;
bus_dma_segment_t *segs = pi->ipi_segs;
union e1000_adv_tx_desc *txd = NULL;
int i, j, first, pidx_last;
int i, j, pidx_last;
u32 olinfo_status, cmd_type_len, txd_flags;
qidx_t ntxd;
@ -249,7 +249,7 @@ igb_isc_txd_encap(void *arg, if_pkt_info_t pi)
if (pi->ipi_mflags & M_VLANTAG)
cmd_type_len |= E1000_ADVTXD_DCMD_VLE;
first = i = pi->ipi_pidx;
i = pi->ipi_pidx;
ntxd = scctx->isc_ntxd[0];
txd_flags = pi->ipi_flags & IPI_TX_INTR ? E1000_ADVTXD_DCMD_RS : 0;
/* Consume the first descriptor */

View file

@ -60,11 +60,9 @@ ofw_clkbus_probe(device_t dev)
static int
ofw_clkbus_attach(device_t dev)
{
struct ofw_clkbus_softc *sc;
phandle_t node, child;
device_t cdev;
sc = device_get_softc(dev);
node = ofw_bus_get_node(dev);
simplebus_init(dev, node);

View file

@ -58,10 +58,8 @@ ofw_regulator_bus_probe(device_t dev)
static int
ofw_regulator_bus_attach(device_t dev)
{
struct ofw_regulator_bus_softc *sc;
phandle_t node, child;
sc = device_get_softc(dev);
node = ofw_bus_get_node(dev);
simplebus_init(dev, node);

View file

@ -155,7 +155,7 @@ fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size)
pcell_t ranges[FDT_RANGES_SIZE], *rangesptr;
pcell_t addr_cells, size_cells, par_addr_cells;
u_long par_bus_addr, pbase, psize;
int err, len, tuple_size, tuples;
int err, len;
if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0)
return (ENXIO);
@ -181,10 +181,6 @@ fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size)
if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0)
return (EINVAL);
tuple_size = sizeof(pcell_t) * (addr_cells + par_addr_cells +
size_cells);
tuples = len / tuple_size;
if (par_addr_cells > 2 || addr_cells > 2 || size_cells > 2)
return (ERANGE);
@ -600,11 +596,9 @@ fdt_get_reserved_regions(struct mem_region *mr, int *mrcnt)
pcell_t reserve[FDT_REG_CELLS * FDT_MEM_REGIONS];
pcell_t *reservep;
phandle_t memory, root;
uint32_t memory_size;
int addr_cells, size_cells;
int i, max_size, res_len, rv, tuple_size, tuples;
int i, res_len, rv, tuple_size, tuples;
max_size = sizeof(reserve);
root = OF_finddevice("/");
memory = OF_finddevice("/memory");
if (memory == -1) {
@ -634,7 +628,6 @@ fdt_get_reserved_regions(struct mem_region *mr, int *mrcnt)
goto out;
}
memory_size = 0;
tuples = res_len / tuple_size;
reservep = (pcell_t *)&reserve;
for (i = 0; i < tuples; i++) {
@ -662,9 +655,8 @@ fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, uint64_t *memsize)
phandle_t memory;
uint64_t memory_size;
int addr_cells, size_cells;
int i, max_size, reg_len, rv, tuple_size, tuples;
int i, reg_len, rv, tuple_size, tuples;
max_size = sizeof(reg);
memory = OF_finddevice("/memory");
if (memory == -1) {
rv = ENXIO;

View file

@ -185,11 +185,9 @@ static void
rdcphy_status(struct mii_softc *sc)
{
struct mii_data *mii;
struct ifmedia_entry *ife;
int bmsr, bmcr, physts;
mii = sc->mii_pdata;
ife = mii->mii_media.ifm_cur;
mii->mii_media_status = IFM_AVALID;
mii->mii_media_active = IFM_ETHER;

View file

@ -751,12 +751,10 @@ static int
dma_prepare(struct dwmmc_softc *sc, struct mmc_command *cmd)
{
struct mmc_data *data;
int len;
int err;
int reg;
data = cmd->data;
len = data->len;
reg = READ4(sc, SDMMC_INTMASK);
reg &= ~(SDMMC_INTMASK_TXDR | SDMMC_INTMASK_RXDR);

View file

@ -1559,17 +1559,14 @@ mmc_host_timing(device_t dev, enum mmc_bus_timing timing)
static void
mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard)
{
enum mmc_bus_timing max_timing, timing;
enum mmc_bus_timing timing;
device_printf(dev, "Card at relative address 0x%04x%s:\n",
ivar->rca, newcard ? " added" : "");
device_printf(dev, " card: %s\n", ivar->card_id_string);
max_timing = bus_timing_normal;
for (timing = bus_timing_max; timing > bus_timing_normal; timing--) {
if (isset(&ivar->timings, timing)) {
max_timing = timing;
if (isset(&ivar->timings, timing))
break;
}
}
device_printf(dev, " quirks: %b\n", ivar->quirks, MMC_QUIRKS_FMT);
device_printf(dev, " bus: %ubit, %uMHz (%s timing)\n",

View file

@ -755,11 +755,9 @@ mmcsd_close(struct disk *dp __unused)
static void
mmcsd_strategy(struct bio *bp)
{
struct mmcsd_softc *sc;
struct mmcsd_part *part;
part = bp->bio_disk->d_drv1;
sc = part->sc;
MMCSD_DISK_LOCK(part);
if (part->running > 0 || part->suspend > 0) {
bioq_disksort(&part->bio_queue, bp);

View file

@ -386,9 +386,8 @@ ofw_bus_search_intrmap(void *intr, int intrsz, void *regs, int physsz,
uint8_t *mptr;
pcell_t paddrsz;
pcell_t pintrsz;
int i, rsz, tsz;
int i, tsz;
rsz = -1;
if (imapmsk != NULL) {
for (i = 0; i < physsz; i++)
ref[i] = uiregs[i] & uiimapmsk[i];
@ -445,7 +444,7 @@ ofw_bus_msimap(phandle_t node, uint16_t pci_rid, phandle_t *msi_parent,
{
pcell_t *map, mask, msi_base, rid_base, rid_length;
ssize_t len;
uint32_t masked_rid, rid;
uint32_t masked_rid;
int err, i;
/* TODO: This should be OF_searchprop_alloc if we had it */
@ -462,7 +461,6 @@ ofw_bus_msimap(phandle_t node, uint16_t pci_rid, phandle_t *msi_parent,
}
err = ENOENT;
rid = 0;
mask = 0xffffffff;
OF_getencprop(node, "msi-map-mask", &mask, sizeof(mask));

View file

@ -558,11 +558,8 @@ static int
ofw_pci_deactivate_resource(device_t bus, device_t child, int type, int rid,
struct resource *res)
{
struct ofw_pci_softc *sc;
vm_size_t psize;
sc = device_get_softc(bus);
if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY) {
return (bus_generic_deactivate_resource(bus, child, type, rid,
res));

View file

@ -3980,7 +3980,6 @@ pci_rescan_method(device_t dev)
{
#define REG(n, w) PCIB_READ_CONFIG(pcib, busno, s, f, n, w)
device_t pcib = device_get_parent(dev);
struct pci_softc *sc;
device_t child, *devlist, *unchanged;
int devcount, error, i, j, maxslots, oldcount;
int busno, domain, s, f, pcifunchigh;
@ -4000,7 +3999,6 @@ pci_rescan_method(device_t dev)
} else
unchanged = NULL;
sc = device_get_softc(dev);
domain = pcib_get_domain(dev);
busno = pcib_get_bus(dev);
maxslots = PCIB_MAXSLOTS(pcib);
@ -4077,12 +4075,10 @@ device_t
pci_add_iov_child(device_t bus, device_t pf, uint16_t rid, uint16_t vid,
uint16_t did)
{
struct pci_devinfo *pf_dinfo, *vf_dinfo;
struct pci_devinfo *vf_dinfo;
device_t pcib;
int busno, slot, func;
pf_dinfo = device_get_ivars(pf);
pcib = device_get_parent(bus);
PCIB_DECODE_RID(pcib, rid, &busno, &slot, &func);

View file

@ -1241,10 +1241,8 @@ static void
pcib_pcie_ab_timeout(void *arg)
{
struct pcib_softc *sc;
device_t dev;
sc = arg;
dev = sc->dev;
mtx_assert(&Giant, MA_OWNED);
if (sc->flags & PCIB_DETACH_PENDING) {
sc->flags |= PCIB_DETACHING;
@ -1484,16 +1482,14 @@ pcib_cfg_save(struct pcib_softc *sc)
static void
pcib_cfg_restore(struct pcib_softc *sc)
{
device_t dev;
#ifndef NEW_PCIB
uint16_t command;
#endif
dev = sc->dev;
#ifdef NEW_PCIB
pcib_write_windows(sc, WIN_IO | WIN_MEM | WIN_PMEM);
#else
command = pci_read_config(dev, PCIR_COMMAND, 2);
command = pci_read_config(sc->dev, PCIR_COMMAND, 2);
if (command & PCIM_CMD_PORTEN)
pcib_set_io_decode(sc);
if (command & PCIM_CMD_MEMEN)

View file

@ -84,17 +84,8 @@ smc_fdt_probe(device_t dev)
static int
smc_fdt_attach(device_t dev)
{
int err;
struct smc_softc *sc;
sc = device_get_softc(dev);
err = smc_attach(dev);
if (err) {
return (err);
}
return (0);
return smc_attach(dev);
}
static int

View file

@ -104,13 +104,11 @@ static int
uart_acpi_probe(device_t dev)
{
struct uart_softc *sc;
device_t parent;
parent = device_get_parent(dev);
sc = device_get_softc(dev);
#if defined(__i386__) || defined(__amd64__)
if (!ISA_PNP_PROBE(parent, dev, acpi_ns8250_ids)) {
if (!ISA_PNP_PROBE(device_get_parent(dev), dev, acpi_ns8250_ids)) {
sc->sc_class = &uart_ns8250_class;
return (uart_bus_probe(dev, 0, 0, 0, 0, 0));
}

View file

@ -381,10 +381,8 @@ uart_pl011_bus_getsig(struct uart_softc *sc)
static int
uart_pl011_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
{
struct uart_bas *bas;
int error;
bas = &sc->sc_bas;
error = 0;
uart_lock(sc->sc_hwmtx);
switch (request) {

View file

@ -110,9 +110,7 @@ UART_FDT_CLASS(compat_data);
static int
snps_get_clocks(device_t dev, clk_t *baudclk, clk_t *apb_pclk)
{
struct snps_softc *sc;
sc = device_get_softc(dev);
*baudclk = NULL;
*apb_pclk = NULL;

View file

@ -170,7 +170,6 @@ int
dwc_otg_detach(device_t dev)
{
struct dwc_otg_fdt_softc *sc = device_get_softc(dev);
int err;
/* during module unload there are lots of children leftover */
device_delete_children(dev);
@ -181,7 +180,7 @@ dwc_otg_detach(device_t dev)
*/
dwc_otg_uninit(&sc->sc_otg);
err = bus_teardown_intr(dev, sc->sc_otg.sc_irq_res,
bus_teardown_intr(dev, sc->sc_otg.sc_irq_res,
sc->sc_otg.sc_intr_hdl);
sc->sc_otg.sc_intr_hdl = NULL;
}

View file

@ -1194,9 +1194,7 @@ ehci_non_isoc_done_sub(struct usb_xfer *xfer)
static void
ehci_non_isoc_done(struct usb_xfer *xfer)
{
ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
ehci_qh_t *qh;
uint32_t status;
usb_error_t err = 0;
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
@ -1216,8 +1214,6 @@ ehci_non_isoc_done(struct usb_xfer *xfer)
usb_pc_cpu_invalidate(qh->page_cache);
status = hc32toh(sc, qh->qh_qtd.qtd_status);
/* reset scanner */
xfer->td_transfer_cache = xfer->td_transfer_first;

View file

@ -2385,7 +2385,6 @@ ohci_xfer_setup(struct usb_setup_params *parm)
{
struct usb_page_search page_info;
struct usb_page_cache *pc;
ohci_softc_t *sc;
struct usb_xfer *xfer;
void *last_obj;
uint32_t ntd;
@ -2393,7 +2392,6 @@ ohci_xfer_setup(struct usb_setup_params *parm)
uint32_t nqh;
uint32_t n;
sc = OHCI_BUS2SC(parm->udev->bus);
xfer = parm->curr_xfer;
parm->hc_max_packet_size = 0x500;

View file

@ -3714,13 +3714,11 @@ xhci_xfer_setup(struct usb_setup_params *parm)
{
struct usb_page_search page_info;
struct usb_page_cache *pc;
struct xhci_softc *sc;
struct usb_xfer *xfer;
void *last_obj;
uint32_t ntd;
uint32_t n;
sc = XHCI_BUS2SC(parm->udev->bus);
xfer = parm->curr_xfer;
/*

View file

@ -1089,7 +1089,6 @@ static void
umass_init_shuttle(struct umass_softc *sc)
{
struct usb_device_request req;
usb_error_t err;
uint8_t status[2] = {0, 0};
/*
@ -1102,7 +1101,7 @@ umass_init_shuttle(struct umass_softc *sc)
req.wIndex[0] = sc->sc_iface_no;
req.wIndex[1] = 0;
USETW(req.wLength, sizeof(status));
err = usbd_do_request(sc->sc_udev, NULL, &req, &status);
usbd_do_request(sc->sc_udev, NULL, &req, &status);
DPRINTF(sc, UDMASS_GEN, "Shuttle init returned 0x%02x%02x\n",
status[0], status[1]);

View file

@ -878,7 +878,7 @@ usb_open(struct cdev *dev, int fflags, int devtype, struct thread *td)
struct usb_fs_privdata* pd = (struct usb_fs_privdata*)dev->si_drv1;
struct usb_cdev_refdata refs;
struct usb_cdev_privdata *cpd;
int err, ep;
int err;
DPRINTFN(2, "%s fflags=0x%08x\n", devtoname(dev), fflags);
@ -890,7 +890,6 @@ usb_open(struct cdev *dev, int fflags, int devtype, struct thread *td)
}
cpd = malloc(sizeof(*cpd), M_USBDEV, M_WAITOK | M_ZERO);
ep = cpd->ep_addr = pd->ep_addr;
usb_loc_fill(pd, cpd);
err = usb_ref_device(cpd, &refs, 1);
@ -1412,8 +1411,6 @@ usb_read(struct cdev *dev, struct uio *uio, int ioflag)
struct usb_cdev_privdata* cpd;
struct usb_fifo *f;
struct usb_mbuf *m;
int fflags;
int resid;
int io_len;
int err;
uint8_t tr_data = 0;
@ -1426,8 +1423,6 @@ usb_read(struct cdev *dev, struct uio *uio, int ioflag)
if (err)
return (ENXIO);
fflags = cpd->fflags;
f = refs.rxfifo;
if (f == NULL) {
/* should not happen */
@ -1435,8 +1430,6 @@ usb_read(struct cdev *dev, struct uio *uio, int ioflag)
return (EPERM);
}
resid = uio->uio_resid;
mtx_lock(f->priv_mtx);
/* check for permanent read error */
@ -1536,8 +1529,6 @@ usb_write(struct cdev *dev, struct uio *uio, int ioflag)
struct usb_fifo *f;
struct usb_mbuf *m;
uint8_t *pdata;
int fflags;
int resid;
int io_len;
int err;
uint8_t tr_data = 0;
@ -1552,15 +1543,12 @@ usb_write(struct cdev *dev, struct uio *uio, int ioflag)
if (err)
return (ENXIO);
fflags = cpd->fflags;
f = refs.txfifo;
if (f == NULL) {
/* should not happen */
usb_unref_device(cpd, &refs);
return (EPERM);
}
resid = uio->uio_resid;
mtx_lock(f->priv_mtx);

View file

@ -761,9 +761,6 @@ static void
nic_send_rss_size(struct nicpf *nic, int vf)
{
union nic_mbx mbx = {};
uint64_t *msg;
msg = (uint64_t *)&mbx;
mbx.rss_size.msg = NIC_MBOX_MSG_RSS_SIZE;
mbx.rss_size.ind_tbl_size = nic->rss_ind_tbl_size;

View file

@ -425,7 +425,6 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct nicvf *nic;
struct rcv_queue *rq;
struct ifreq *ifr;
uint32_t flags;
int mask, err;
int rq_idx;
#if defined(INET) || defined(INET6)
@ -482,7 +481,6 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
NICVF_CORE_LOCK(nic);
if (if_getflags(ifp) & IFF_UP) {
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
flags = if_getflags(ifp) ^ nic->if_flags;
if ((nic->if_flags & if_getflags(ifp)) &
IFF_PROMISC) {
/* Change promiscous mode */

View file

@ -1714,13 +1714,12 @@ nicvf_sq_disable(struct nicvf *nic, int qidx)
static void
nicvf_sq_free_used_descs(struct nicvf *nic, struct snd_queue *sq, int qidx)
{
uint64_t head, tail;
uint64_t head;
struct snd_buff *snd_buff;
struct sq_hdr_subdesc *hdr;
NICVF_TX_LOCK(sq);
head = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_HEAD, qidx) >> 4;
tail = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_TAIL, qidx) >> 4;
while (sq->head != head) {
hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, sq->head);
if (hdr->subdesc_type != SQ_DESC_TYPE_HEADER) {

View file

@ -680,7 +680,6 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
struct iso_node *ip;
struct buf *bp;
struct vnode *vp;
struct cdev *dev;
int error;
struct thread *td;
@ -707,7 +706,6 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
*/
imp = VFSTOISOFS(mp);
dev = imp->im_dev;
/* Allocate a new vnode/iso_node. */
if ((error = getnewvnode("isofs", mp, &cd9660_vnodeops, &vp)) != 0) {

View file

@ -493,7 +493,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
uint32_t retseq, retval, slotseq, *tl;
time_t waituntil;
int i = 0, j = 0, opcnt, set_sigset = 0, slot;
int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS;
int error = 0, usegssname = 0, secflavour = AUTH_SYS;
int freeslot, maxslot, reterr, slotpos, timeo;
u_int16_t procnum;
u_int trylater_delay = 1;
@ -702,7 +702,6 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
}
#endif
}
trycnt = 0;
freeslot = -1; /* Set to slot that needs to be free'd */
tryagain:
slot = -1; /* Slot that needs a sequence# increment. */
@ -1229,8 +1228,7 @@ newnfs_msleep(struct thread *td, void *ident, struct mtx *mtx, int priority, cha
{
sigset_t oldset;
int error;
struct proc *p;
if ((priority & PCATCH) == 0)
return msleep(ident, mtx, priority, wmesg, timo);
if (td == NULL)
@ -1238,7 +1236,6 @@ newnfs_msleep(struct thread *td, void *ident, struct mtx *mtx, int priority, cha
newnfs_set_sigmask(td, &oldset);
error = msleep(ident, mtx, priority, wmesg, timo);
newnfs_restore_sigmask(td, &oldset);
p = td->td_proc;
return (error);
}

View file

@ -487,7 +487,7 @@ nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, int size, int set_true)
{
u_int32_t *tl;
u_int8_t *cp;
int fullsiz, rem, bytesize = 0;
int fullsiz, bytesize = 0;
if (size == 0)
size = NFSX_MYFH;
@ -504,7 +504,6 @@ nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, int size, int set_true)
case ND_NFSV3:
case ND_NFSV4:
fullsiz = NFSM_RNDUP(size);
rem = fullsiz - size;
if (set_true) {
bytesize = 2 * NFSX_UNSIGNED + fullsiz;
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);

View file

@ -4116,7 +4116,6 @@ nfscl_relock(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp,
struct nfscllockowner *nlp;
struct nfsfh *nfhp;
u_int64_t off, len;
u_int32_t clidrev = 0;
int error, newone, donelocally;
off = lop->nfslo_first;
@ -4126,10 +4125,6 @@ nfscl_relock(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp,
lp->nfsl_openowner, &nlp, &newone, &donelocally);
if (error || donelocally)
return (error);
if (nmp->nm_clp != NULL)
clidrev = nmp->nm_clp->nfsc_clientidrev;
else
clidrev = 0;
nfhp = VTONFS(vp)->n_fhp;
error = nfscl_trylock(nmp, vp, nfhp->nfh_fh,
nfhp->nfh_len, nlp, newone, 0, off,

View file

@ -347,7 +347,7 @@ nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp,
struct iovec aiov;
struct uio auio;
int lockleaf = (cnp->cn_flags & LOCKLEAF) != 0, linklen;
int error = 0, crossmnt;
int error = 0;
char *cp;
*retdirp = NULL;
@ -372,7 +372,6 @@ nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp,
if (NFSVNO_EXRDONLY(exp))
cnp->cn_flags |= RDONLY;
ndp->ni_segflg = UIO_SYSSPACE;
crossmnt = 1;
if (nd->nd_flag & ND_PUBLOOKUP) {
ndp->ni_loopcnt = 0;
@ -400,7 +399,6 @@ nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp,
* the mount point, unless nfsrv_enable_crossmntpt is set.
*/
cnp->cn_flags |= NOCROSSMOUNT;
crossmnt = 0;
}
/*

View file

@ -3267,7 +3267,7 @@ APPLESTATIC int
nfsrv_openupdate(vnode_t vp, struct nfsstate *new_stp, nfsquad_t clientid,
nfsv4stateid_t *stateidp, struct nfsrv_descript *nd, NFSPROC_T *p)
{
struct nfsstate *stp, *ownerstp;
struct nfsstate *stp;
struct nfsclient *clp;
struct nfslockfile *lfp;
u_int32_t bits;
@ -3366,7 +3366,6 @@ nfsrv_openupdate(vnode_t vp, struct nfsstate *new_stp, nfsquad_t clientid,
}
NFSUNLOCKSTATE();
} else if (new_stp->ls_flags & NFSLCK_CLOSE) {
ownerstp = stp->ls_openowner;
lfp = stp->ls_lfp;
if (nfsrv_dolocallocks != 0 && !LIST_EMPTY(&stp->ls_open)) {
/* Get the lf lock */

View file

@ -876,7 +876,7 @@ int
g_access(struct g_consumer *cp, int dcr, int dcw, int dce)
{
struct g_provider *pp;
int pr,pw,pe;
int pw, pe;
int error;
g_topology_assert();
@ -907,7 +907,6 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int dce)
* Figure out what counts the provider would have had, if this
* consumer had (r0w0e0) at this time.
*/
pr = pp->acr - cp->acr;
pw = pp->acw - cp->acw;
pe = pp->ace - cp->ace;

View file

@ -955,7 +955,6 @@ g_raid_dirty(struct g_raid_volume *vol)
void
g_raid_tr_flush_common(struct g_raid_tr_object *tr, struct bio *bp)
{
struct g_raid_softc *sc;
struct g_raid_volume *vol;
struct g_raid_subdisk *sd;
struct bio_queue_head queue;
@ -963,7 +962,6 @@ g_raid_tr_flush_common(struct g_raid_tr_object *tr, struct bio *bp)
int i;
vol = tr->tro_volume;
sc = vol->v_softc;
/*
* Allocate all bios before sending any request, so we can return

View file

@ -757,10 +757,8 @@ ddf_meta_create(struct g_raid_disk *disk, struct ddf_meta *sample)
static void
ddf_meta_copy(struct ddf_meta *dst, struct ddf_meta *src)
{
struct ddf_header *hdr;
u_int ss;
hdr = src->hdr;
dst->bigendian = src->bigendian;
ss = dst->sectorsize = src->sectorsize;
dst->hdr = malloc(ss, M_MD_DDF, M_WAITOK);
@ -845,10 +843,8 @@ ddf_vol_meta_create(struct ddf_vol_meta *meta, struct ddf_meta *sample)
{
struct timespec ts;
struct clocktime ct;
struct ddf_header *hdr;
u_int ss, size;
hdr = sample->hdr;
meta->bigendian = sample->bigendian;
ss = meta->sectorsize = sample->sectorsize;
meta->hdr = malloc(ss, M_MD_DDF, M_WAITOK);
@ -874,13 +870,11 @@ static void
ddf_vol_meta_update(struct ddf_vol_meta *dst, struct ddf_meta *src,
uint8_t *GUID, int started)
{
struct ddf_header *hdr;
struct ddf_vd_entry *vde;
struct ddf_vdc_record *vdc;
int vnew, bvnew, bvd, size;
u_int ss;
hdr = src->hdr;
vde = &src->vdr->entry[ddf_meta_find_vd(src, GUID)];
vdc = ddf_meta_find_vdc(src, GUID);
if (GET8D(src, vdc->Secondary_Element_Count) == 1)
@ -1427,12 +1421,10 @@ static int
g_raid_md_ddf_purge_volumes(struct g_raid_softc *sc)
{
struct g_raid_volume *vol, *tvol;
struct g_raid_md_ddf_pervolume *pv;
int i, res;
res = 0;
TAILQ_FOREACH_SAFE(vol, &sc->sc_volumes, v_next, tvol) {
pv = vol->v_md_data;
if (vol->v_stopping)
continue;
for (i = 0; i < vol->v_disks_count; i++) {
@ -1866,7 +1858,6 @@ g_raid_md_ddf_start(struct g_raid_volume *vol)
struct g_raid_md_ddf_pervolume *pv;
struct g_raid_md_ddf_object *mdi;
struct ddf_vol_meta *vmeta;
struct ddf_vdc_record *vdc;
uint64_t *val2;
int i, j, bvd;
@ -1875,7 +1866,6 @@ g_raid_md_ddf_start(struct g_raid_volume *vol)
mdi = (struct g_raid_md_ddf_object *)md;
pv = vol->v_md_data;
vmeta = &pv->pv_meta;
vdc = vmeta->vdc;
vol->v_raid_level = GET8(vmeta, vdc->Primary_RAID_Level);
vol->v_raid_level_qualifier = GET8(vmeta, vdc->RLQ);

View file

@ -1100,7 +1100,7 @@ g_raid_md_taste_promise(struct g_raid_md_object *md, struct g_class *mp,
struct g_provider *pp;
struct g_raid_softc *sc;
struct g_raid_disk *disk;
struct promise_raid_conf *meta, *metaarr[4];
struct promise_raid_conf *metaarr[4];
struct g_raid_md_promise_perdisk *pd;
struct g_geom *geom;
int i, j, result, len, subdisks;
@ -1111,7 +1111,6 @@ g_raid_md_taste_promise(struct g_raid_md_object *md, struct g_class *mp,
pp = cp->provider;
/* Read metadata from device. */
meta = NULL;
g_topology_unlock();
vendor = 0xffff;
len = sizeof(vendor);

View file

@ -344,10 +344,8 @@ static void
g_raid_tr_iostart_raid5(struct g_raid_tr_object *tr, struct bio *bp)
{
struct g_raid_volume *vol;
struct g_raid_tr_raid5_object *trs;
vol = tr->tro_volume;
trs = (struct g_raid_tr_raid5_object *)tr;
if (vol->v_state < G_RAID_VOLUME_S_SUBOPTIMAL) {
g_raid_iodone(bp, EIO);
return;

View file

@ -131,14 +131,12 @@ _sleep(void *ident, struct lock_object *lock, int priority,
const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
{
struct thread *td;
struct proc *p;
struct lock_class *class;
uintptr_t lock_state;
int catch, pri, rval, sleepq_flags;
WITNESS_SAVE_DECL(lock_witness);
td = curthread;
p = td->td_proc;
#ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
ktrcsw(1, 0, wmesg);
@ -177,7 +175,7 @@ _sleep(void *ident, struct lock_object *lock, int priority,
sleepq_lock(ident);
CTR5(KTR_PROC, "sleep: thread %ld (pid %ld, %s) on %s (%p)",
td->td_tid, p->p_pid, td->td_name, wmesg, ident);
td->td_tid, td->td_proc->p_pid, td->td_name, wmesg, ident);
if (lock == &Giant.lock_object)
mtx_assert(&Giant, MA_OWNED);
@ -235,12 +233,10 @@ msleep_spin_sbt(void *ident, struct mtx *mtx, const char *wmesg,
sbintime_t sbt, sbintime_t pr, int flags)
{
struct thread *td;
struct proc *p;
int rval;
WITNESS_SAVE_DECL(mtx);
td = curthread;
p = td->td_proc;
KASSERT(mtx != NULL, ("sleeping without a mutex"));
KASSERT(ident != NULL, ("msleep_spin_sbt: NULL ident"));
KASSERT(TD_IS_RUNNING(td), ("msleep_spin_sbt: curthread not running"));
@ -250,7 +246,7 @@ msleep_spin_sbt(void *ident, struct mtx *mtx, const char *wmesg,
sleepq_lock(ident);
CTR5(KTR_PROC, "msleep_spin: thread %ld (pid %ld, %s) on %s (%p)",
td->td_tid, p->p_pid, td->td_name, wmesg, ident);
td->td_tid, td->td_proc->p_pid, td->td_name, wmesg, ident);
DROP_GIANT();
mtx_assert(mtx, MA_OWNED | MA_NOTRECURSED);

View file

@ -767,10 +767,8 @@ link_elf_load_file(linker_class_t cls, const char* filename,
Elf_Phdr *segs[MAXSEGS];
int nsegs;
Elf_Phdr *phdyn;
Elf_Phdr *phphdr;
caddr_t mapbase;
size_t mapsize;
Elf_Off base_offset;
Elf_Addr base_vaddr;
Elf_Addr base_vlimit;
int error = 0;
@ -869,7 +867,6 @@ link_elf_load_file(linker_class_t cls, const char* filename,
phlimit = phdr + hdr->e_phnum;
nsegs = 0;
phdyn = NULL;
phphdr = NULL;
while (phdr < phlimit) {
switch (phdr->p_type) {
case PT_LOAD:
@ -885,10 +882,6 @@ link_elf_load_file(linker_class_t cls, const char* filename,
++nsegs;
break;
case PT_PHDR:
phphdr = phdr;
break;
case PT_DYNAMIC:
phdyn = phdr;
break;
@ -916,7 +909,6 @@ link_elf_load_file(linker_class_t cls, const char* filename,
* out our contiguous region, and to establish the base
* address for relocation.
*/
base_offset = trunc_page(segs[0]->p_offset);
base_vaddr = trunc_page(segs[0]->p_vaddr);
base_vlimit = round_page(segs[nsegs - 1]->p_vaddr +
segs[nsegs - 1]->p_memsz);

View file

@ -187,11 +187,10 @@ msgbuf_addstr(struct msgbuf *mbp, int pri, char *str, int filter_cr)
size_t len, prefix_len;
char prefix[MAXPRIBUF];
char buf[32];
int nl, i, j, needtime;
int i, j, needtime;
len = strlen(str);
prefix_len = 0;
nl = 0;
/* If we have a zero-length string, no need to do anything. */
if (len == 0)

View file

@ -1141,11 +1141,10 @@ sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue,
struct stack **st;
struct sbuf **td_infos;
int i, stack_idx, error, stacks_to_allocate;
bool finished, partial_print;
bool finished;
error = 0;
finished = false;
partial_print = false;
KASSERT(wchan != NULL, ("%s: invalid NULL wait channel", __func__));
MPASS((queue >= 0) && (queue < NR_SLEEPQS));

View file

@ -1806,7 +1806,6 @@ static struct witness *
enroll(const char *description, struct lock_class *lock_class)
{
struct witness *w;
struct witness_list *typelist;
MPASS(description != NULL);
@ -1815,11 +1814,7 @@ enroll(const char *description, struct lock_class *lock_class)
if ((lock_class->lc_flags & LC_SPINLOCK)) {
if (witness_skipspin)
return (NULL);
else
typelist = &w_spin;
} else if ((lock_class->lc_flags & LC_SLEEPLOCK)) {
typelist = &w_sleep;
} else {
} else if ((lock_class->lc_flags & LC_SLEEPLOCK) == 0) {
kassert_panic("lock class %s is not sleep or spin",
lock_class->lc_name);
return (NULL);
@ -1865,14 +1860,11 @@ enroll(const char *description, struct lock_class *lock_class)
static void
depart(struct witness *w)
{
struct witness_list *list;
MPASS(w->w_refcount == 0);
if (w->w_class->lc_flags & LC_SLEEPLOCK) {
list = &w_sleep;
w_sleep_cnt--;
} else {
list = &w_spin;
w_spin_cnt--;
}
/*
@ -2546,7 +2538,6 @@ sbuf_print_witness_badstacks(struct sbuf *sb, size_t *oldidx)
{
struct witness_lock_order_data *data1, *data2, *tmp_data1, *tmp_data2;
struct witness *tmp_w1, *tmp_w2, *w1, *w2;
u_int w_rmatrix1, w_rmatrix2;
int generation, i, j;
tmp_data1 = NULL;
@ -2616,8 +2607,6 @@ sbuf_print_witness_badstacks(struct sbuf *sb, size_t *oldidx)
* spin lock.
*/
*tmp_w2 = *w2;
w_rmatrix1 = (unsigned int)w_rmatrix[i][j];
w_rmatrix2 = (unsigned int)w_rmatrix[j][i];
if (data1) {
stack_zero(&tmp_data1->wlod_stack);

View file

@ -963,7 +963,6 @@ aio_schedule_fsync(void *context, int pending)
bool
aio_cancel_cleared(struct kaiocb *job)
{
struct kaioinfo *ki;
/*
* The caller should hold the same queue lock held when
@ -971,7 +970,6 @@ aio_cancel_cleared(struct kaiocb *job)
* ensuring this check sees an up-to-date value. However,
* there is no way to assert that.
*/
ki = job->userproc->p_aioinfo;
return ((job->jobflags & KAIOCB_CLEARED) != 0);
}
@ -1692,7 +1690,6 @@ aio_cancel_sync(struct kaiocb *job)
int
aio_queue_file(struct file *fp, struct kaiocb *job)
{
struct aioliojob *lj;
struct kaioinfo *ki;
struct kaiocb *job2;
struct vnode *vp;
@ -1700,7 +1697,6 @@ aio_queue_file(struct file *fp, struct kaiocb *job)
int error, opcode;
bool safe;
lj = job->lio;
ki = job->userproc->p_aioinfo;
opcode = job->uaiocb.aio_lio_opcode;
if (opcode == LIO_SYNC)

View file

@ -1133,7 +1133,7 @@ static void
vnlru_proc(void)
{
struct mount *mp, *nmp;
unsigned long ofreevnodes, onumvnodes;
unsigned long onumvnodes;
int done, force, reclaim_nc_src, trigger, usevnodes;
EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc,
@ -1170,7 +1170,6 @@ vnlru_proc(void)
}
mtx_unlock(&vnode_free_list_mtx);
done = 0;
ofreevnodes = freevnodes;
onumvnodes = numvnodes;
/*
* Calculate parameters for recycling. These are the same

View file

@ -290,7 +290,6 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
int hlen; /* link layer header length */
uint32_t pflags;
struct llentry *lle = NULL;
struct rtentry *rt0 = NULL;
int addref = 0;
phdr = NULL;
@ -320,7 +319,6 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
pflags = lle->r_flags;
}
}
rt0 = ro->ro_rt;
}
#ifdef MAC

View file

@ -520,7 +520,6 @@ gif_input(struct mbuf *m, struct ifnet *ifp, int proto, uint8_t ecn)
struct ip6_hdr *ip6;
uint32_t t;
#endif
struct gif_softc *sc;
struct ether_header *eh;
struct ifnet *oldifp;
int isr, n, af;
@ -530,7 +529,6 @@ gif_input(struct mbuf *m, struct ifnet *ifp, int proto, uint8_t ecn)
m_freem(m);
return;
}
sc = ifp->if_softc;
m->m_pkthdr.rcvif = ifp;
m_clrprotoflags(m);
switch (proto) {

View file

@ -198,7 +198,9 @@ tcp_output(struct tcpcb *tp)
int off, flags, error = 0; /* Keep compiler happy */
struct mbuf *m;
struct ip *ip = NULL;
#ifdef TCPDEBUG
struct ipovly *ipov = NULL;
#endif
struct tcphdr *th;
u_char opt[TCP_MAXOLEN];
unsigned ipoptlen, optlen, hdrlen;
@ -1091,7 +1093,9 @@ tcp_output(struct tcpcb *tp)
#endif /* INET6 */
{
ip = mtod(m, struct ip *);
#ifdef TCPDEBUG
ipov = (struct ipovly *)ip;
#endif
th = (struct tcphdr *)(ip + 1);
tcpip_fillheaders(tp->t_inpcb, ip, th);
}

View file

@ -1238,11 +1238,8 @@ in6_mc_join_locked(struct ifnet *ifp, const struct in6_addr *mcaddr,
int
in6_mc_leave(struct in6_multi *inm, /*const*/ struct in6_mfilter *imf)
{
struct ifnet *ifp;
int error;
ifp = inm->in6m_ifp;
IN6_MULTI_LOCK();
error = in6_mc_leave_locked(inm, imf);
IN6_MULTI_UNLOCK();

View file

@ -160,7 +160,6 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
*/
#define REPLACE(r) do {\
IP6STAT_INC(ip6s_sources_rule[(r)]); \
rule = (r); \
/* { \
char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \
printf("in6_selectsrc: replace %s with %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \
@ -176,7 +175,6 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
} while(0)
#define BREAK(r) do { \
IP6STAT_INC(ip6s_sources_rule[(r)]); \
rule = (r); \
goto out; /* XXX: we can't use 'break' here */ \
} while(0)
@ -194,7 +192,7 @@ in6_selectsrc(uint32_t fibnum, struct sockaddr_in6 *dstsock,
struct in6_addrpolicy *dst_policy = NULL, *best_policy = NULL;
u_int32_t odstzone;
int prefer_tempaddr;
int error, rule;
int error;
struct ip6_moptions *mopts;
KASSERT(srcp != NULL, ("%s: srcp is NULL", __func__));
@ -310,7 +308,6 @@ in6_selectsrc(uint32_t fibnum, struct sockaddr_in6 *dstsock,
if (error)
return (error);
rule = 0;
IN6_IFADDR_RLOCK(&in6_ifa_tracker);
TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
int new_scope = -1, new_matchlen = -1;

View file

@ -2286,7 +2286,7 @@ mld_v2_enqueue_group_record(struct mbufq *mq, struct in6_multi *inm,
struct ifnet *ifp;
struct ip6_msource *ims, *nims;
struct mbuf *m0, *m, *md;
int error, is_filter_list_change;
int is_filter_list_change;
int minrec0len, m0srcs, msrcs, nbytes, off;
int record_has_sources;
int now;
@ -2298,7 +2298,6 @@ mld_v2_enqueue_group_record(struct mbufq *mq, struct in6_multi *inm,
IN6_MULTI_LOCK_ASSERT();
error = 0;
ifp = inm->in6m_ifp;
is_filter_list_change = 0;
m = NULL;

View file

@ -2113,7 +2113,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
LLE_RUNLOCK(ln);
if (chain != NULL)
nd6_flush_holdchain(ifp, ifp, chain, &sin6);
nd6_flush_holdchain(ifp, chain, &sin6);
/*
* When the link-layer address of a router changes, select the
@ -2502,23 +2502,18 @@ nd6_resolve_addr(struct ifnet *ifp, int flags, const struct sockaddr *dst,
}
int
nd6_flush_holdchain(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *chain,
nd6_flush_holdchain(struct ifnet *ifp, struct mbuf *chain,
struct sockaddr_in6 *dst)
{
struct mbuf *m, *m_head;
struct ifnet *outifp;
int error = 0;
m_head = chain;
if ((ifp->if_flags & IFF_LOOPBACK) != 0)
outifp = origifp;
else
outifp = ifp;
while (m_head) {
m = m_head;
m_head = m_head->m_nextpkt;
error = nd6_output_ifp(ifp, origifp, m, dst, NULL);
error = nd6_output_ifp(ifp, ifp, m, dst, NULL);
}
/*
@ -2526,7 +2521,7 @@ nd6_flush_holdchain(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *chain
* note that intermediate errors are blindly ignored
*/
return (error);
}
}
static int
nd6_need_cache(struct ifnet *ifp)

View file

@ -448,7 +448,7 @@ void nd6_cache_lladdr(struct ifnet *, struct in6_addr *,
char *, int, int, int);
void nd6_grab_holdchain(struct llentry *, struct mbuf **,
struct sockaddr_in6 *);
int nd6_flush_holdchain(struct ifnet *, struct ifnet *, struct mbuf *,
int nd6_flush_holdchain(struct ifnet *, struct mbuf *,
struct sockaddr_in6 *);
int nd6_add_ifa_lle(struct in6_ifaddr *);
void nd6_rem_ifa_lle(struct in6_ifaddr *, int);

View file

@ -894,7 +894,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
LLE_WUNLOCK(ln);
if (chain != NULL)
nd6_flush_holdchain(ifp, ifp, chain, &sin6);
nd6_flush_holdchain(ifp, chain, &sin6);
if (checklink)
pfxlist_onlink_check();
@ -1515,17 +1515,11 @@ nd6_dad_ns_output(struct dadq *dp)
static void
nd6_dad_ns_input(struct ifaddr *ifa, struct nd_opt_nonce *ndopt_nonce)
{
struct in6_ifaddr *ia;
struct ifnet *ifp;
const struct in6_addr *taddr6;
struct dadq *dp;
if (ifa == NULL)
panic("ifa == NULL in nd6_dad_ns_input");
ia = (struct in6_ifaddr *)ifa;
ifp = ifa->ifa_ifp;
taddr6 = &ia->ia_addr.sin6_addr;
/* Ignore Nonce option when Enhanced DAD is disabled. */
if (V_dad_enhanced == 0)
ndopt_nonce = NULL;

View file

@ -339,9 +339,6 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
void
rip6_ctlinput(int cmd, struct sockaddr *sa, void *d)
{
struct ip6_hdr *ip6;
struct mbuf *m;
int off = 0;
struct ip6ctlparam *ip6cp = NULL;
const struct sockaddr_in6 *sa6_src = NULL;
void *cmdarg;
@ -365,14 +362,9 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, void *d)
*/
if (d != NULL) {
ip6cp = (struct ip6ctlparam *)d;
m = ip6cp->ip6c_m;
ip6 = ip6cp->ip6c_ip6;
off = ip6cp->ip6c_off;
cmdarg = ip6cp->ip6c_cmdarg;
sa6_src = ip6cp->ip6c_src;
} else {
m = NULL;
ip6 = NULL;
cmdarg = NULL;
sa6_src = &sa6_any;
}
@ -391,7 +383,6 @@ rip6_output(struct mbuf *m, struct socket *so, ...)
struct mbuf *control;
struct m_tag *mtag;
struct sockaddr_in6 *dstsock;
struct in6_addr *dst;
struct ip6_hdr *ip6;
struct inpcb *in6p;
u_int plen = m->m_pkthdr.len;
@ -413,7 +404,6 @@ rip6_output(struct mbuf *m, struct socket *so, ...)
in6p = sotoinpcb(so);
INP_WLOCK(in6p);
dst = &dstsock->sin6_addr;
if (control != NULL) {
if ((error = ip6_setpktopts(control, &opt,
in6p->in6p_outputopts, so->so_cred,

View file

@ -1190,7 +1190,6 @@ udp6_disconnect(struct socket *so)
{
struct inpcb *inp;
struct inpcbinfo *pcbinfo;
int error;
pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
inp = sotoinpcb(so);
@ -1212,8 +1211,8 @@ udp6_disconnect(struct socket *so)
#endif
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
error = ENOTCONN;
goto out;
INP_WUNLOCK(inp);
return (ENOTCONN);
}
INP_HASH_WLOCK(pcbinfo);
@ -1223,7 +1222,6 @@ udp6_disconnect(struct socket *so)
SOCK_LOCK(so);
so->so_state &= ~SS_ISCONNECTED; /* XXX */
SOCK_UNLOCK(so);
out:
INP_WUNLOCK(inp);
return (0);
}

View file

@ -5744,7 +5744,6 @@ static int
key_setident(struct secashead *sah, const struct sadb_msghdr *mhp)
{
const struct sadb_ident *idsrc, *iddst;
int idsrclen, iddstlen;
IPSEC_ASSERT(sah != NULL, ("null secashead"));
IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
@ -5766,8 +5765,6 @@ key_setident(struct secashead *sah, const struct sadb_msghdr *mhp)
idsrc = (const struct sadb_ident *)mhp->ext[SADB_EXT_IDENTITY_SRC];
iddst = (const struct sadb_ident *)mhp->ext[SADB_EXT_IDENTITY_DST];
idsrclen = mhp->extlen[SADB_EXT_IDENTITY_SRC];
iddstlen = mhp->extlen[SADB_EXT_IDENTITY_DST];
/* validity check */
if (idsrc->sadb_ident_type != iddst->sadb_ident_type) {
@ -7464,7 +7461,6 @@ key_dump(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
SAHTREE_RLOCK_TRACKER;
struct secashead *sah;
struct secasvar *sav;
struct sadb_msg *newmsg;
struct mbuf *n;
uint32_t cnt;
uint8_t proto, satype;
@ -7501,7 +7497,6 @@ key_dump(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
}
/* send this to the userland, one at a time. */
newmsg = NULL;
TAILQ_FOREACH(sah, &V_sahtree, chain) {
if (mhp->msg->sadb_msg_satype != SADB_SATYPE_UNSPEC &&
proto != sah->saidx.proto)

View file

@ -685,9 +685,7 @@ ah_input_cb(struct cryptop *crp)
{
IPSEC_DEBUG_DECLARE(char buf[IPSEC_ADDRSTRLEN]);
unsigned char calc[AH_ALEN_MAX];
const struct auth_hash *ahx;
struct mbuf *m;
struct cryptodesc *crd;
struct xform_data *xd;
struct secasvar *sav;
struct secasindex *saidx;
@ -696,7 +694,6 @@ ah_input_cb(struct cryptop *crp)
int authsize, rplen, error, skip, protoff;
uint8_t nxt;
crd = crp->crp_desc;
m = (struct mbuf *) crp->crp_buf;
xd = (struct xform_data *) crp->crp_opaque;
sav = xd->sav;
@ -709,8 +706,6 @@ ah_input_cb(struct cryptop *crp)
saidx->dst.sa.sa_family == AF_INET6,
("unexpected protocol family %u", saidx->dst.sa.sa_family));
ahx = sav->tdb_authalgxform;
/* Check for crypto errors. */
if (crp->crp_etype) {
if (crp->crp_etype == EAGAIN) {

View file

@ -441,7 +441,6 @@ esp_input_cb(struct cryptop *crp)
IPSEC_DEBUG_DECLARE(char buf[128]);
u_int8_t lastthree[3], aalg[AH_HMAC_MAXHASHLEN];
const struct auth_hash *esph;
const struct enc_xform *espx;
struct mbuf *m;
struct cryptodesc *crd;
struct xform_data *xd;
@ -462,7 +461,6 @@ esp_input_cb(struct cryptop *crp)
cryptoid = xd->cryptoid;
saidx = &sav->sah->saidx;
esph = sav->tdb_authalgxform;
espx = sav->tdb_encalgxform;
/* Check for crypto errors */
if (crp->crp_etype) {

View file

@ -274,7 +274,6 @@ static int
ipcomp_input_cb(struct cryptop *crp)
{
IPSEC_DEBUG_DECLARE(char buf[IPSEC_ADDRSTRLEN]);
struct cryptodesc *crd;
struct xform_data *xd;
struct mbuf *m;
struct secasvar *sav;
@ -285,8 +284,6 @@ ipcomp_input_cb(struct cryptop *crp)
int skip, protoff;
uint8_t nproto;
crd = crp->crp_desc;
m = (struct mbuf *) crp->crp_buf;
xd = (struct xform_data *) crp->crp_opaque;
sav = xd->sav;

View file

@ -225,11 +225,9 @@ fha_hash_entry_remove(struct fha_hash_entry *e)
static struct fha_hash_entry *
fha_hash_entry_lookup(struct fha_params *softc, u_int64_t fh)
{
SVCPOOL *pool;
struct fha_hash_slot *fhs;
struct fha_hash_entry *fhe, *new_fhe;
pool = *softc->pool;
fhs = &softc->fha_hash[fh % FHA_HASH_SIZE];
new_fhe = fha_hash_entry_new(fh);
new_fhe->mtx = &fhs->mtx;
@ -289,12 +287,9 @@ fha_hash_entry_choose_thread(struct fha_params *softc,
struct fha_hash_entry *fhe, struct fha_info *i, SVCTHREAD *this_thread)
{
SVCTHREAD *thread, *min_thread = NULL;
SVCPOOL *pool;
int req_count, min_count = 0;
off_t offset1, offset2;
pool = *softc->pool;
LIST_FOREACH(thread, &fhe->threads, st_alink) {
req_count = thread->st_p2;
@ -475,17 +470,13 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, struct fha_params *softc)
struct fha_hash_entry *fhe;
bool_t first, hfirst;
SVCTHREAD *thread;
SVCPOOL *pool;
sbuf_new(&sb, NULL, 65536, SBUF_FIXEDLEN);
pool = NULL;
if (!*softc->pool) {
sbuf_printf(&sb, "NFSD not running\n");
goto out;
}
pool = *softc->pool;
for (i = 0; i < FHA_HASH_SIZE; i++)
if (!LIST_EMPTY(&softc->fha_hash[i].list))

View file

@ -348,7 +348,6 @@ static CLIENT *
nlm_get_rpc(struct sockaddr *sa, rpcprog_t prog, rpcvers_t vers)
{
char *wchan = "nlmrcv";
const char* protofmly;
struct sockaddr_storage ss;
struct socket *so;
CLIENT *rpcb;
@ -370,14 +369,11 @@ nlm_get_rpc(struct sockaddr *sa, rpcprog_t prog, rpcvers_t vers)
switch (ss.ss_family) {
case AF_INET:
((struct sockaddr_in *)&ss)->sin_port = htons(111);
protofmly = "inet";
so = nlm_socket;
break;
#ifdef INET6
case AF_INET6:
((struct sockaddr_in6 *)&ss)->sin6_port = htons(111);
protofmly = "inet6";
so = nlm_socket6;
break;
#endif

View file

@ -994,7 +994,7 @@ kdriver_suitable(const struct cryptocap *cap, const struct cryptkop *krp)
static struct cryptocap *
crypto_select_kdriver(const struct cryptkop *krp, int flags)
{
struct cryptocap *cap, *best, *blocked;
struct cryptocap *cap, *best;
int match, hid;
CRYPTO_DRIVER_ASSERT();
@ -1007,7 +1007,6 @@ crypto_select_kdriver(const struct cryptkop *krp, int flags)
else
match = CRYPTOCAP_F_SOFTWARE;
best = NULL;
blocked = NULL;
again:
for (hid = 0; hid < crypto_drivers_num; hid++) {
cap = &crypto_drivers[hid];

View file

@ -986,7 +986,6 @@ swcr_freesession_locked(device_t dev, u_int64_t tid)
struct swcr_data *swd;
struct enc_xform *txf;
struct auth_hash *axf;
struct comp_algo *cxf;
u_int32_t sid = CRYPTO_SESID2LID(tid);
if (sid > swcr_sesnum || swcr_sessions == NULL ||
@ -1061,7 +1060,7 @@ swcr_freesession_locked(device_t dev, u_int64_t tid)
break;
case CRYPTO_DEFLATE_COMP:
cxf = swd->sw_cxf;
/* Nothing to do */
break;
}

View file

@ -346,7 +346,6 @@ clnt_dg_call(
int retransmit_time;
int next_sendtime, starttime, rtt, time_waited, tv = 0;
struct sockaddr *sa;
socklen_t salen;
uint32_t xid = 0;
struct mbuf *mreq = NULL, *results;
struct cu_request *cr;
@ -398,13 +397,10 @@ clnt_dg_call(
}
cu->cu_connected = 1;
}
if (cu->cu_connected) {
if (cu->cu_connected)
sa = NULL;
salen = 0;
} else {
else
sa = (struct sockaddr *)&cu->cu_raddr;
salen = cu->cu_rlen;
}
time_waited = 0;
retrans = 0;
if (ext && ext->rc_timers) {

View file

@ -230,7 +230,6 @@ sys___mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
struct pipe *pipe;
struct socket *so;
cap_rights_t rights;
short label_type;
int error;
error = copyin(uap->mac_p, &mac, sizeof(mac));
@ -253,7 +252,6 @@ sys___mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
if (error)
goto out;
label_type = fp->f_type;
switch (fp->f_type) {
case DTYPE_FIFO:
case DTYPE_VNODE:

View file

@ -2414,13 +2414,11 @@ ffs_vfree(pvp, ino, mode)
int mode;
{
struct ufsmount *ump;
struct inode *ip;
if (DOINGSOFTDEP(pvp)) {
softdep_freefile(pvp, ino, mode);
return (0);
}
ip = VTOI(pvp);
ump = VFSTOUFS(pvp->v_mount);
return (ffs_freefile(ump, ump->um_fs, ump->um_devvp, ino, mode, NULL));
}

View file

@ -1369,7 +1369,6 @@ vop_deleteextattr {
*/
{
struct inode *ip;
struct fs *fs;
struct extattr *eap;
uint32_t ul;
int olen, error, i, easize;
@ -1377,7 +1376,6 @@ vop_deleteextattr {
void *tmp;
ip = VTOI(ap->a_vp);
fs = ITOFS(ip);
if (ap->a_vp->v_type == VCHR || ap->a_vp->v_type == VBLK)
return (EOPNOTSUPP);