power: max17042: divide by 0 Crash because r_sns init too late
MyungJoo Ham
Acked-byPhilip Rakity<[email protected]> Date : 2011-08-13 13:18 (GMT+09:00)
Quoted 9 lines
On MMP2 brownstone divide by 0 error since probe sets
r_snsafter callingpower_supply_register.Move the code up a few lines.
r_snscomes from the platform data.
PROP_CURRENT_AVGandPROP_CURRENTdivide the result byr_sns.Signed-off-by Philip Rakity
Quoted 32 lines
---
drivers/power/max17042_battery.c| 6 +++---1 files changed, 3 insertions(+), 3 deletions(-)drivers/power/max17042_battery.c +3
-3@@ -210,6 +210,9 @@ static int __devinit max17042_probe(struct i2c_client *client,if (!chip->pdata->enable_current_sense) chip->battery.num_properties -=2 ; +if (chip->pdata->r_sns ==0 ) + chip->pdata->r_sns =MAX17042_DEFAULT_SNS_RESISTOR ; + ret =power_supply_register (&client->dev, &chip->battery);if (ret) {dev_err (&client->dev,"failed: power supply register\n" );@@ -226,9 +229,6 @@ static int __devinit max17042_probe(struct i2c_client *client,max17042_write_reg (client,MAX17042_CGAIN ,0x0000 );max17042_write_reg (client, MAX17042_MiscCFG,0x0003 );max17042_write_reg (client, MAX17042_LearnCFG,0x0007 ); - }else { -if (chip->pdata->r_sns ==0 ) - chip->pdata->r_sns =MAX17042_DEFAULT_SNS_RESISTOR ; }return 0 ;Signature · 1 line
1.7.0.4
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�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m����띠�◀?뻀�
Anton Vorontsov
AppliedQuoted 4 lines · MyungJoo Ham
Philip Rakity<[email protected]> Date : 2011-08-13 13:18 (GMT+09:00)
Quoted 3 lines
On MMP2 brownstone divide by 0 error since probe sets
r_snsafter callingpower_supply_register.
Quoted 8 lines
Quoted 6 lines
Move the code up a few lines.
r_snscomes from the platform data.
PROP_CURRENT_AVGandPROP_CURRENTdivide the result byr_sns.Signed-off-by Philip RakityAcked-by MyungJoo Ham <[email protected]>
Applied, thanks.
Signature · 2 lines
Anton Vorontsov Email: [email protected]