From patchwork Fri Feb 15 12:56:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14897 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 946D023E01 for ; Fri, 15 Feb 2013 12:57:46 +0000 (UTC) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by fiordland.canonical.com (Postfix) with ESMTP id 4ED62A18025 for ; Fri, 15 Feb 2013 12:57:46 +0000 (UTC) Received: by mail-vc0-f175.google.com with SMTP id fw7so2142769vcb.34 for ; Fri, 15 Feb 2013 04:57:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=+lK+JWNoWs8MnfS0Gsf/JVrSbe1bgRjC42/CcsFWv4w=; b=J6QDl7GerAMjoZvVFJwXvjt5EX9dMiFlih8OUKodZqdR5cNJbKi7I7T5oBI23wpAJO 2X3fRp0Qf70GITEvI3lY2TGdZpF/WgJ/9Y9RB8bvsfCHkM/RvFRFHqe8VX55Wny0QAN2 QQ0tzHVsFhYk7k2Am59G9DLREJph7rQQ9QeynR01NS0ll06abe/dv/nbg3s8RaWEEyM7 HfgDimHiW+ggdWlgPKKrIz3UU10dNt+XsB5zm5z8qMiuEFWV1/YUKfDs4Ql41l16up1m InNeu+Hk5VvPLri/ruIwTNTRh/kavXk92jllF/o1Nd/AVyKmf7cMCBOnBVUsQFu5p9jO wStg== X-Received: by 10.220.240.141 with SMTP id la13mr2878753vcb.39.1360933065795; Fri, 15 Feb 2013 04:57:45 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.221.4.5 with SMTP id oa5csp11377vcb; Fri, 15 Feb 2013 04:57:45 -0800 (PST) X-Received: by 10.180.104.10 with SMTP id ga10mr3915979wib.23.1360933064928; Fri, 15 Feb 2013 04:57:44 -0800 (PST) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx.google.com with ESMTPS id h16si18146609wjr.216.2013.02.15.04.57.44 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:57:44 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wi0-f178.google.com with SMTP id o1so1117392wic.5 for ; Fri, 15 Feb 2013 04:57:44 -0800 (PST) X-Received: by 10.194.238.226 with SMTP id vn2mr4039699wjc.23.1360933064420; Fri, 15 Feb 2013 04:57:44 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id j4sm2852410wiz.10.2013.02.15.04.57.42 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:57:43 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: arnd@arndb.de, linus.walleij@stericsson.com, Jonas Aaberg , Lee Jones Subject: [PATCH 12/35] mfd: ab8500-debug: Better error handling on crash Date: Fri, 15 Feb 2013 12:56:43 +0000 Message-Id: <1360933026-30325-13-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> References: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnkXGiztwoaIM15gL6SwS5Dz8EEBkwAkNewkBqJU3LvezdP240tNS+T0Ml4bGQixK3hqky8 From: Jonas Aaberg Stop trying to read i2c registers if one fail. Signed-off-by: Jonas Aaberg Signed-off-by: Lee Jones Reviewed-by: Mattias WALLIN --- drivers/mfd/ab8500-debugfs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 250b77b..8b15fc2 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -607,7 +607,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); @@ -617,6 +616,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"); @@ -629,11 +629,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; @@ -643,11 +644,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)