From 1543e317f1da31b75942316931e8f491a8920811 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Thu, 04 Jan 2024 10:08:02 +0000
Subject: [PATCH] disable FB
---
kernel/drivers/power/supply/rk816_battery.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/kernel/drivers/power/supply/rk816_battery.c b/kernel/drivers/power/supply/rk816_battery.c
index d204a01..1e4f6cd 100644
--- a/kernel/drivers/power/supply/rk816_battery.c
+++ b/kernel/drivers/power/supply/rk816_battery.c
@@ -328,6 +328,9 @@
u8 i;
u16 d;
+ if (size < 2)
+ return 0;
+
for (i = 0; i < size; i++) {
if (value < table[i])
break;
@@ -2965,6 +2968,8 @@
FINISH_CHRG_CUR2 : FINISH_CHRG_CUR1;
finish_sec = base2sec(di->chrg_finish_base);
soc_sec = di->fcc * 3600 / 100 / DIV(finish_current);
+ if (soc_sec == 0)
+ soc_sec = 1;
plus_soc = finish_sec / DIV(soc_sec);
if (finish_sec > soc_sec) {
rest = finish_sec % soc_sec;
@@ -4671,7 +4676,7 @@
}
pdata->ocv_size = length / sizeof(u32);
- if (pdata->ocv_size <= 0) {
+ if (pdata->ocv_size < 2) {
dev_err(dev, "invalid ocv table\n");
return -EINVAL;
}
--
Gitblit v1.6.2