diff options
author | Jonas Aaberg <jonas.aberg@stericsson.com> | 2012-06-18 10:35:28 +0200 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2013-03-07 12:27:52 +0800 |
commit | 222460cb4b2fe1c1e84f3302a8d8dbc4a94f6837 (patch) | |
tree | f2abb5061e2e4c4ba8aade141cb8ddae35ca4811 /drivers/mfd/ab8500-debugfs.c | |
parent | 3e1a498f2728476535571d270081a17fdfceaf26 (diff) | |
download | op-kernel-dev-222460cb4b2fe1c1e84f3302a8d8dbc4a94f6837.zip op-kernel-dev-222460cb4b2fe1c1e84f3302a8d8dbc4a94f6837.tar.gz |
mfd: ab8500-debug: Better error handling on crash
Stop trying to read i2c registers if one fail.
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/ab8500-debugfs.c')
-rw-r--r-- | drivers/mfd/ab8500-debugfs.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 7febf17..1e76a2f 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -608,7 +608,6 @@ struct ab8500_register_dump u8 bank; u8 reg; u8 value; - int ret; } ab8500_complete_register_dump[DUMP_MAX_REGS]; extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); @@ -618,6 +617,7 @@ void ab8500_dump_all_banks_to_mem(void) { int i, r = 0; u8 bank; + int err = 0; pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" " "for crash analyze.\n"); @@ -630,11 +630,12 @@ void ab8500_dump_all_banks_to_mem(void) reg <= debug_ranges[bank].range[i].last; reg++) { u8 value; - int err; err = prcmu_abb_read(bank, reg, &value, 1); - ab8500_complete_register_dump[r].ret = err; + if (err < 0) + goto out; + ab8500_complete_register_dump[r].bank = bank; ab8500_complete_register_dump[r].reg = reg; ab8500_complete_register_dump[r].value = value; @@ -644,11 +645,17 @@ void ab8500_dump_all_banks_to_mem(void) if (r >= DUMP_MAX_REGS) { pr_err("%s: too many register to dump!\n", __func__); - return; + err = -EINVAL; + goto out; } } } } +out: + if (err >= 0) + pr_info("Saved all ABB registers.\n"); + else + pr_info("Failed to save all ABB registers.\n"); } static int ab8500_all_banks_open(struct inode *inode, struct file *file) |