google_battery: handle gdf > 100 in ssoc_change_curve()

SSOC: l=100% gdf=100.02 uic=100.00 rl=100.00 ct=-1 curve:[15.00 15.00][96.99 100.00][100.00 100.00] rls=1 bd_cnt=1
SSOC: l=100% gdf=100.02 uic=100.00 rl=100.00 ct=-1 curve:[15.00 15.00][95.00 100.00][100.00 100.00] rls=-1 bd_cnt=1

[96.99 100.00] should change to [100.00 100.00] instead of [95.00 100.00].

Bug: 187133830
Change-Id: I7c3364be702002cd2aaa1a2042c645807228b824
Signed-off-by: Ken Tsou <[email protected]>
(cherry picked from commit 85477d32422b5c963750cf4271a86ab7d9403f81)
diff --git a/google_battery.c b/google_battery.c
index ec09243..54498cd 100644
--- a/google_battery.c
+++ b/google_battery.c
@@ -736,6 +736,10 @@
 		gdf -=  delta;
 	}
 
+	/* adjust gdf to update curve[1].real in ssoc_uicurve_splice() */
+	if (gdf > ssoc_point_full)
+		gdf = ssoc_point_full;
+
 	ssoc_change_curve_at_gdf(ssoc_state, gdf,
 				 ssoc_get_capacity_raw(ssoc_state), type);
 }