Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350658
b: refs/heads/master
c: 64d26f2
h: refs/heads/master
v: v3
  • Loading branch information
Dan Carpenter authored and Anton Vorontsov committed Feb 16, 2013
1 parent dfb0d17 commit 795ecdd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 049645d753e39cb64c8563faf865b0689256cf28
refs/heads/master: 64d26f225fefe06c870634e7bfe026a063e7f776
16 changes: 9 additions & 7 deletions trunk/drivers/power/generic-adc-battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,6 @@ static int gab_probe(struct platform_device *pdev)
psy->external_power_changed = gab_ext_power_changed;
adc_bat->pdata = pdata;

/* calculate the total number of channels */
chan = ARRAY_SIZE(gab_chan_name);

/*
* copying the static properties and allocating extra memory for holding
* the extra configurable properties received from platform data.
Expand All @@ -291,6 +288,7 @@ static int gab_probe(struct platform_device *pdev)
gab_chan_name[chan]);
if (IS_ERR(adc_bat->channel[chan])) {
ret = PTR_ERR(adc_bat->channel[chan]);
adc_bat->channel[chan] = NULL;
} else {
/* copying properties for supported channels only */
memcpy(properties + sizeof(*(psy->properties)) * index,
Expand Down Expand Up @@ -344,8 +342,10 @@ static int gab_probe(struct platform_device *pdev)
gpio_req_fail:
power_supply_unregister(psy);
err_reg_fail:
for (chan = 0; ARRAY_SIZE(gab_chan_name); chan++)
iio_channel_release(adc_bat->channel[chan]);
for (chan = 0; chan < ARRAY_SIZE(gab_chan_name); chan++) {
if (adc_bat->channel[chan])
iio_channel_release(adc_bat->channel[chan]);
}
second_mem_fail:
kfree(psy->properties);
first_mem_fail:
Expand All @@ -365,8 +365,10 @@ static int gab_remove(struct platform_device *pdev)
gpio_free(pdata->gpio_charge_finished);
}

for (chan = 0; ARRAY_SIZE(gab_chan_name); chan++)
iio_channel_release(adc_bat->channel[chan]);
for (chan = 0; chan < ARRAY_SIZE(gab_chan_name); chan++) {
if (adc_bat->channel[chan])
iio_channel_release(adc_bat->channel[chan]);
}

kfree(adc_bat->psy.properties);
cancel_delayed_work(&adc_bat->bat_work);
Expand Down

0 comments on commit 795ecdd

Please sign in to comment.