diff options
author | njl <njl@FreeBSD.org> | 2005-11-24 05:23:56 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2005-11-24 05:23:56 +0000 |
commit | b4b8d998c55380484e5a01f59f83628904d48496 (patch) | |
tree | 44ac9e686eb1d97ab550e2bd15b6d1b2cba83b1a /sys/dev/acpica | |
parent | 792c8e2f4900802933c70899fadd6312270e880d (diff) | |
download | FreeBSD-src-b4b8d998c55380484e5a01f59f83628904d48496.zip FreeBSD-src-b4b8d998c55380484e5a01f59f83628904d48496.tar.gz |
Only copy out the battery status/info if there was no error.
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r-- | sys/dev/acpica/acpi_smbat.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/acpica/acpi_smbat.c b/sys/dev/acpica/acpi_smbat.c index 37216e1..39bfb3c 100644 --- a/sys/dev/acpica/acpi_smbat.c +++ b/sys/dev/acpica/acpi_smbat.c @@ -371,11 +371,11 @@ acpi_smbat_get_bst(device_t dev, struct acpi_bst *bst) sc->bst.volt = val; acpi_smbat_info_updated(&sc->bst_lastupdated); - error = 0; out: - memcpy(bst, &sc->bst, sizeof(sc->bst)); + if (error == 0) + memcpy(bst, &sc->bst, sizeof(sc->bst)); ACPI_SERIAL_END(smbat); return (error); } @@ -445,13 +445,14 @@ acpi_smbat_get_bif(device_t dev, struct acpi_bif *bif) sc->bif.oeminfo, sizeof(sc->bif.oeminfo))) goto out; - acpi_smbat_info_updated(&sc->bif_lastupdated); - /* XXX check if device was replugged during read? */ + + acpi_smbat_info_updated(&sc->bif_lastupdated); error = 0; out: - memcpy(bif, &sc->bif, sizeof(sc->bif)); + if (error == 0) + memcpy(bif, &sc->bif, sizeof(sc->bif)); ACPI_SERIAL_END(smbat); return (error); } |