Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 May 2022 22:54:52 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 24c581ffa917 - stable/13 - powerpc pmu: Don't use garbage battery info.
Message-ID:  <202205132254.24DMsq0W078338@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=24c581ffa9177cdc3770126d886a1def5d68fc06

commit 24c581ffa9177cdc3770126d886a1def5d68fc06
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-12 21:58:58 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-05-13 20:13:43 +0000

    powerpc pmu: Don't use garbage battery info.
    
    If pmu_query_battery fails, don't notify a change in battery status.
    
    Reviewed by:    jhibbits
    Differential Revision:  https://reviews.freebsd.org/D34889
    
    (cherry picked from commit 5f2995aa950f99ca124a450e4e57c9966fba802a)
---
 sys/powerpc/powermac/pmu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/powerpc/powermac/pmu.c b/sys/powerpc/powermac/pmu.c
index 97865174cc2f..ae01b9251b11 100644
--- a/sys/powerpc/powermac/pmu.c
+++ b/sys/powerpc/powermac/pmu.c
@@ -964,7 +964,7 @@ pmu_battery_notify(struct pmu_battstate *batt, struct pmu_battstate *old)
 }
 
 static void
-pmu_battquery_proc()
+pmu_battquery_proc(void)
 {
 	struct pmu_softc *sc;
 	struct pmu_battstate batt;
@@ -977,8 +977,10 @@ pmu_battquery_proc()
 	while (1) {
 		kproc_suspend_check(curproc);
 		error = pmu_query_battery(sc, 0, &batt);
-		pmu_battery_notify(&batt, &cur_batt);
-		cur_batt = batt;
+		if (error == 0) {
+			pmu_battery_notify(&batt, &cur_batt);
+			cur_batt = batt;
+		}
 		pause("pmu_batt", hz);
 	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202205132254.24DMsq0W078338>