summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorSebastian Reichel <sre@kernel.org>2019-04-15 22:40:29 +0200
committerSebastian Reichel <sre@kernel.org>2019-04-15 22:40:29 +0200
commit6f76aa94e1d2f4e8758f65fd3ea08006303a1582 (patch)
tree462fac0be51ed72bcfdea28353b4e3bc9823324d /drivers/power
parentpower: supply: gpio-charger: Add support for charger status. (diff)
parentpower: supply: cpcap-battery: Fix division by zero (diff)
downloadlinux-6f76aa94e1d2f4e8758f65fd3ea08006303a1582.tar.xz
linux-6f76aa94e1d2f4e8758f65fd3ea08006303a1582.zip
Merge branch 'psy-fixes' into psy-next
Merge fixes branch into next branch for cpcap-battery patches. Signed-off-by: Sebastian Reichel <sre@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/cpcap-battery.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
index 08d5037fd052..6887870ba32c 100644
--- a/drivers/power/supply/cpcap-battery.c
+++ b/drivers/power/supply/cpcap-battery.c
@@ -221,6 +221,9 @@ static int cpcap_battery_cc_raw_div(struct cpcap_battery_ddata *ddata,
int avg_current;
u32 cc_lsb;
+ if (!divider)
+ return 0;
+
sample &= 0xffffff; /* 24-bits, unsigned */
offset &= 0x7ff; /* 10-bits, signed */