aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-sony.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index a51a9c0636be..b39e3abd6cdd 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -854,7 +854,8 @@ static void sixaxis_parse_report(struct sony_sc *sc, __u8 *rd, int size)
854 battery_capacity = 100; 854 battery_capacity = 100;
855 battery_charging = !(rd[30] & 0x01); 855 battery_charging = !(rd[30] & 0x01);
856 } else { 856 } else {
857 battery_capacity = sixaxis_battery_capacity[rd[30]]; 857 __u8 index = rd[30] <= 5 ? rd[30] : 5;
858 battery_capacity = sixaxis_battery_capacity[index];
858 battery_charging = 0; 859 battery_charging = 0;
859 } 860 }
860 cable_state = !((rd[31] >> 4) & 0x01); 861 cable_state = !((rd[31] >> 4) & 0x01);