public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: MAX8997: Fix for divide by zero error
@ 2011-06-21  3:38 Tushar Behera
  2011-06-21 10:08 ` Mark Brown
  2011-07-04 16:05 ` Liam Girdwood
  0 siblings, 2 replies; 5+ messages in thread
From: Tushar Behera @ 2011-06-21  3:38 UTC (permalink / raw)
  To: linux-kernel, linaro-dev
  Cc: patches, lrg, broonie, MyungJoo Ham, Kyungmin Park, Samuel Ortiz

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 <lrg@ti.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 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++)
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [PATCH] regulator: MAX8997: Fix for divide by zero error
@ 2011-06-22  2:48 함명주
  2011-06-22  3:22 ` Tushar Behera
  0 siblings, 1 reply; 5+ messages in thread
From: 함명주 @ 2011-06-22  2:48 UTC (permalink / raw)
  To: Tushar Behera, linux-kernel@vger.kernel.org,
	linaro-dev@lists.linaro.org
  Cc: patches@linaro.org, lrg@ti.com,
	broonie@opensource.wolfsonmicro.com, 박경민,
	Samuel Ortiz

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 2016 bytes --]

Sender : Tushar Behera<tushar.behera@linaro.org>
Date : 2011-06-21 12:38 (GMT+09:00)
> 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 

Although I've never been reported such an issue, but I'm sure this will cause one any time. Thanks!

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

> ---
> 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++)
> -- 
> 1.7.4.1
> 
> 



 MyungJoo Ham (ÇÔ¸íÁÖ)
Mobile Software Platform Lab,
Digital Media and Communications (DMC) Business
Samsung Electronics
cell: +82-10-6714-2858 / office: +82-31-279-8033ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-04 16:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21  3:38 [PATCH] regulator: MAX8997: Fix for divide by zero error Tushar Behera
2011-06-21 10:08 ` Mark Brown
2011-07-04 16:05 ` Liam Girdwood
  -- strict thread matches above, loose matches on Subject: below --
2011-06-22  2:48 함명주
2011-06-22  3:22 ` Tushar Behera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox