NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/61015: sys/dev/acpi/pckbc_acpi.c:242:63: error: 'handle' may be used uninitialized
The following reply was made to PR kern/61015; it has been noted by GNATS.
From: Ali Raheem <ali%SDF.ORG@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: kern/61015: sys/dev/acpi/pckbc_acpi.c:242:63: error: 'handle'
may be used uninitialized
Date: Mon, 16 Nov 2026 20:14:39 +0000
Hi linear,
Thanks for the report.
As an alternative, I've moved the interrupt setup inside the lookup
loop, and used `psc->sc_handle` directly.
This removes the redundant `handle` variable entirely, along with the
existing `XXX: gcc` initialisation of `psc`.
Testing:
Built and booted amd64 GENERIC (-current 11.99.11) under VMware,
kbd and aux interrupts worked, keyboard works. I haven't tested
with the i386 config that originally triggered the warning.
If this fix is useful, I could test against your config if you send
it over (I missed you on IRC to ask).
Kind regards,
Ali
diff --git sys/dev/acpi/pckbc_acpi.c sys/dev/acpi/pckbc_acpi.c
index 99350f7a1..92a684b28 100644
--- sys/dev/acpi/pckbc_acpi.c
+++ sys/dev/acpi/pckbc_acpi.c
@@ -219,9 +219,8 @@ out:
static void
pckbc_acpi_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
{
- struct pckbc_acpi_softc *psc = NULL; /* XXX: gcc */
+ struct pckbc_acpi_softc *psc;
void *rv = NULL;
- ACPI_HANDLE handle;
char intr_name[64];
int i;
@@ -231,17 +230,16 @@ pckbc_acpi_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
for (i = 0; i < pckbc_cd.cd_ndevs; i++) {
psc = device_lookup_private(&pckbc_cd, i);
if (psc && psc->sc_slot == slot) {
- handle = psc->sc_handle;
+ snprintf(intr_name, sizeof(intr_name), "%s %s",
+ device_xname(psc->sc_pckbc.sc_dv),
+ pckbc_slot_names[slot]);
+
+ rv = acpi_intr_establish(sc->sc_dv,
+ (uint64_t)(uintptr_t)psc->sc_handle,
+ IPL_TTY, false, pckbcintr, sc, intr_name);
break;
}
}
- if (i < pckbc_cd.cd_ndevs) {
- snprintf(intr_name, sizeof(intr_name), "%s %s",
- device_xname(psc->sc_pckbc.sc_dv), pckbc_slot_names[slot]);
-
- rv = acpi_intr_establish(sc->sc_dv, (uint64_t)(uintptr_t)handle,
- IPL_TTY, false, pckbcintr, sc, intr_name);
- }
if (rv == NULL) {
aprint_error_dev(sc->sc_dv,
"unable to establish interrupt for %s slot\n",
--
ali%sdf.org@localhost
SDF Public Access UNIX System - http://sdf.org
Home |
Main Index |
Thread Index |
Old Index