--- a/sys/dev/acpica/acpi_sony/acpi_sony.c +++ b/sys/dev/acpica/acpi_sony/acpi_sony.c @@ -180,12 +180,15 @@ { device_t dev = arg1; int function = oidp->oid_arg2; - int error = 0, val; + int error, val = 0; - acpi_GetInteger(acpi_get_handle(dev), + error = acpi_GetInteger(acpi_get_handle(dev), acpi_sony_oids[function].getmethod, &val); + if (error != 0) + return (error); error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr || !acpi_sony_oids[function].setmethod) + if (error != 0 || req->newptr == NULL || + acpi_sony_oids[function].setmethod == NULL) return (error); acpi_SetInteger(acpi_get_handle(dev), acpi_sony_oids[function].setmethod, val);