Skip to contentSkip to conversation

ppc32: Fix warning in pmac battery code

PATCH New Benjamin Herrenschmidt 1 participant 1 message Sep 24, 2004 Linux for power macintosh

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc32: Fix warning in pmac battery code

Hi !

The battery calculation code in via-pmu triggers a few warnings (and actually, one of them would lead to a real error if we ever get an unrecognized type from the PMU). Fix this.

drivers/macintosh/via-pmu.c +3 -2
diff -urN linux-2.5/drivers/macintosh/via-pmu.c linux-lappy/drivers/macintosh/via-pmu.c
@@ -747,6 +747,8 @@
 		pmu_power_flags &= ~PMU_PWR_AC_PRESENT;
 
 
+	capa = max = amperage = voltage = 0;
+	
 	if (req->reply[1] & 0x04) {
 		bat_flags |= PMU_BATT_PRESENT;
 		switch(req->reply[0]) {
@@ -766,8 +768,7 @@
 					req->reply_len, req->reply[0], req->reply[1], req->reply[2], req->reply[3]);
 				break;
 		}
-	} else
-		capa = max = amperage = voltage = 0;
+	}
 
 	if ((req->reply[1] & 0x01) && (amperage > 0))
 		bat_flags |= PMU_BATT_CHARGING;