linux/drivers/power
Daniel Mack a4e3f91b98 ds2760_battery.c: fix division by zero
The 'battery remaining capacity' calculation in
drivers/power/ds2760_battery.c lacks a parameter check to a division
operation which causes the kernel to oops on my board.

[   21.233750] Division by zero in kernel.
[   21.237646] [<c002955c>] (__div0+0x0/0x20) from [<c012561c>] (Ldiv0+0x8/0x10)
[   21.244816] [<c01bef34>] (ds2760_battery_read_status+0x0/0x2a4) from [<c01bf3a4>] (ds2760_battery_get_property+0x30/0xdc)
[   21.255803]  r8:c03a22c0 r7:c7886100 r6:00000009 r5:c782fe7c r4:c7886084
[   21.262518] [<c01bf374>] (ds2760_battery_get_property+0x0/0xdc) from [<c01bde98>] (power_supply_show_property+0x48/0x114)
[   21.273480]  r6:c7996000 r5:00000009 r4:00000000
[   21.278111] [<c01bde50>] (power_supply_show_property+0x0/0x114) from [<c01be158>] (power_supply_uevent+0x188/0x280)
[   21.288537]  r8:00000001 r7:c7886100 r6:c7996000 r5:000000b4 r4:00000000
[   21.295222] [<c01bdfd0>] (power_supply_uevent+0x0/0x280) from [<c015c664>] (dev_uevent+0xd4/0x10c)
[   21.304199] [<c015c590>] (dev_uevent+0x0/0x10c) from [<c0128440>] (kobject_uevent_env+0x180/0x390)
[   21.313170]  r5:00000000 r4:c78860ac
[   21.316725] [<c01282c0>] (kobject_uevent_env+0x0/0x390) from [<c0128664>] (kobject_uevent+0x14/0x18)
[   21.325850] [<c0128650>] (kobject_uevent+0x0/0x18) from [<c01bdc34>] (power_supply_changed_work+0x5c/0x70)
[   21.335506] [<c01bdbd8>] (power_supply_changed_work+0x0/0x70) from [<c004d290>] (run_workqueue+0xbc/0x144)
[   21.345167]  r4:c7812040
[   21.347716] [<c004d1d4>] (run_workqueue+0x0/0x144) from [<c004d94c>] (worker_thread+0xa8/0xbc)
[   21.356296]  r7:c7812040 r6:c7820b00 r5:c782ffa4 r4:c7812048
[   21.361957] [<c004d8a4>] (worker_thread+0x0/0xbc) from [<c0051008>] (kthread+0x5c/0x94)
[   21.369971]  r7:00000000 r6:c004d8a4 r5:c7812040 r4:c782e000
[   21.375612] [<c0050fac>] (kthread+0x0/0x94) from [<c00403d0>] (do_exit+0x0/0x688)

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Acked-by: Matt Reimer <mreimer@vpop.net>
Acked-by: Anton Vorontsov <cbou@mail.ru>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-03-12 16:20:23 -07:00
..
apm_power.c Driver Core: add ability for class_for_each_device to start in middle of list 2008-07-21 21:54:47 -07:00
bq27x00_battery.c bq27x00_battery: use unaligned access helper 2008-09-26 03:46:12 +04:00
da9030_battery.c power_supply: Add Dialog DA9030 battery charger driver 2009-01-04 12:17:41 +01:00
ds2760_battery.c ds2760_battery.c: fix division by zero 2009-03-12 16:20:23 -07:00
Kconfig power_supply: PCF50633 battery charger driver 2009-01-11 01:34:24 +01:00
Makefile power_supply: PCF50633 battery charger driver 2009-01-11 01:34:24 +01:00
olpc_battery.c olpc: olpc_battery.c sparse endian annotations 2008-10-16 11:21:30 -07:00
pcf50633-charger.c pcf50633_charger: Fix typo 2009-02-02 19:53:02 +03:00
pda_power.c power_supply: pda_power: Don't request shared IRQs w/ IRQF_DISABLED 2009-01-26 02:09:26 +03:00
pmu_battery.c PMU battery: filenames in sysfs with spaces 2008-05-03 03:40:42 +04:00
power_supply_core.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2008-10-18 20:28:24 +04:00
power_supply_leds.c power: replace remaining __FUNCTION__ occurrences 2008-04-29 08:05:58 -07:00
power_supply_sysfs.c power_supply: Add cold to the POWER_SUPPLY_HEALTH report values 2009-01-04 12:17:39 +01:00
power_supply.h Driver core: change add_uevent_var to use a struct 2007-10-12 14:51:01 -07:00
tosa_battery.c [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach 2008-08-07 09:55:48 +01:00
wm97xx_battery.c [ARM] 5248/1: wm97xx generic battery driver 2008-10-02 22:48:34 +01:00
wm8350_power.c power_supply: Add battery health reporting for WM8350 2009-01-04 12:17:39 +01:00