From patchwork Tue Jun 21 03:38:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 2110 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 8519E23E54 for ; Tue, 21 Jun 2011 03:39:39 +0000 (UTC) Received: from mail-vw0-f52.google.com (mail-vw0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id 1DF48A18443 for ; Tue, 21 Jun 2011 03:39:38 +0000 (UTC) Received: by vws16 with SMTP id 16so4295392vws.11 for ; Mon, 20 Jun 2011 20:39:38 -0700 (PDT) Received: by 10.52.95.194 with SMTP id dm2mr6779876vdb.47.1308627577942; Mon, 20 Jun 2011 20:39:37 -0700 (PDT) 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.52.183.130 with SMTP id em2cs40742vdc; Mon, 20 Jun 2011 20:39:37 -0700 (PDT) Received: by 10.42.180.66 with SMTP id bt2mr156916icb.450.1308627576223; Mon, 20 Jun 2011 20:39:36 -0700 (PDT) Received: from mail-pv0-f178.google.com (mail-pv0-f178.google.com [74.125.83.178]) by mx.google.com with ESMTPS id m3si37112887icx.43.2011.06.20.20.39.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Jun 2011 20:39:35 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.178 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) client-ip=74.125.83.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.83.178 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) smtp.mail=tushar.behera@linaro.org Received: by pvg7 with SMTP id 7so2662706pvg.37 for ; Mon, 20 Jun 2011 20:39:34 -0700 (PDT) Received: by 10.68.36.71 with SMTP id o7mr2436142pbj.277.1308627573903; Mon, 20 Jun 2011 20:39:33 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id x2sm236805pbn.29.2011.06.20.20.39.29 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Jun 2011 20:39:32 -0700 (PDT) From: Tushar Behera To: linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org Cc: patches@linaro.org, lrg@ti.com, broonie@opensource.wolfsonmicro.com, MyungJoo Ham , Kyungmin Park , Samuel Ortiz Subject: [PATCH] regulator: MAX8997: Fix for divide by zero error Date: Tue, 21 Jun 2011 09:08:59 +0530 Message-Id: <1308627539-8980-1-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.4.1 Currently, ramp_delay variable is used uninitialzed in max8997_set_voltage_ldobuck which gets called through regulator_register calls. To fix the problem, in max8997_pmic_probe, ramp_delay initialization code is moved before calls to regulator_register. Cc: Liam Girdwood Cc: Mark Brown Cc: MyungJoo Ham Cc: Kyungmin Park Cc: Samuel Ortiz Signed-off-by: Tushar Behera Acked-by: Mark Brown --- drivers/regulator/max8997.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 10d5a1d..0fc7b8c 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c @@ -1124,6 +1124,10 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) 0x3f); } + /* Misc Settings */ + max8997->ramp_delay = 10; /* set 10mV/us, which is the default */ + max8997_write_reg(i2c, MAX8997_REG_BUCKRAMP, (0xf << 4) | 0x9); + for (i = 0; i < pdata->num_regulators; i++) { const struct voltage_map_desc *desc; int id = pdata->regulators[i].id; @@ -1148,10 +1152,6 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) } } - /* Misc Settings */ - max8997->ramp_delay = 10; /* set 10mV/us, which is the default */ - max8997_write_reg(i2c, MAX8997_REG_BUCKRAMP, (0xf << 4) | 0x9); - return 0; err: for (i = 0; i < max8997->num_regulators; i++)