rtc: HYM8563: fix probe error handling by destroy wake lock

fix this bug:
 Unable to handle kernel paging request at virtual address 00020008
 pgd = d3e60000
 [00020008] *pgd=00000000
 Internal error: Oops: 5 [#1] PREEMPT SMP
 CPU: 1    Tainted: G         C   (3.0.36+ #6)
 PC is at print_lock_stat+0x1c/0x1b8
 LR is at wakelock_stats_show+0x3c/0xa4

or this bug:
 WARNING: at lib/list_debug.c:26 __list_add+0x60/0x90()
 list_add corruption. next->prev should be prev (c0ae4468), but was 05900000. (next=d89bb060).
 [<c043ece0>] (unwind_backtrace+0x0/0xfc) from [<c046dacc>] (warn_slowpath_common+0x4c/0x64)
 [<c046dacc>] (warn_slowpath_common+0x4c/0x64) from [<c046db78>] (warn_slowpath_fmt+0x30/0x40)
 [<c046db78>] (warn_slowpath_fmt+0x30/0x40) from [<c060554c>] (__list_add+0x60/0x90)
 [<c060554c>] (__list_add+0x60/0x90) from [<c04a6140>] (wake_lock_init+0x8c/0xe4)
 [<c04a6140>] (wake_lock_init+0x8c/0xe4) from [<c071bda0>] (power_supply_register+0xd8/0x100)
 [<c071bda0>] (power_supply_register+0xd8/0x100) from [<c041e5d8>] (test_power_init+0x18/0x7c)
 [<c041e5d8>] (test_power_init+0x18/0x7c) from [<c04335d0>] (do_one_initcall+0x34/0x17c)
 [<c04335d0>] (do_one_initcall+0x34/0x17c) from [<c0408370>] (kernel_init+0x98/0x144)
 [<c0408370>] (kernel_init+0x98/0x144) from [<c0439f64>] (kernel_thread_exit+0x0/0x8)
This commit is contained in:
黄涛 2013-03-18 15:14:13 +08:00
parent d02a97f84a
commit 940efe7e52

View File

@ -486,8 +486,10 @@ static int __devinit hym8563_probe(struct i2c_client *client, const struct i2c_d
exit:
if (rtc)
rtc_device_unregister(rtc);
if (hym8563)
if (hym8563) {
wake_lock_destroy(&hym8563->wake_lock);
kfree(hym8563);
}
return rc;
}