Skip to content

Commit

Permalink
hwmon: fix freeing of gpio_data and irq
Browse files Browse the repository at this point in the history
If already requested, gpio_data and irq should be freed in the case of an
error.

Signed-off-by: Roel Kluin <[email protected]>
Acked-by: Jonathan Cameron <[email protected]>
Cc: David Brownell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
RoelKluin authored and torvalds committed Sep 22, 2009
1 parent 905ffdc commit 560a64a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/hwmon/sht15.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ static int __devinit sht15_probe(struct platform_device *pdev)
ret = sysfs_create_group(&pdev->dev.kobj, &sht15_attr_group);
if (ret) {
dev_err(&pdev->dev, "sysfs create failed");
goto err_free_data;
goto err_release_gpio_data;
}

ret = request_irq(gpio_to_irq(data->pdata->gpio_data),
Expand All @@ -581,10 +581,12 @@ static int __devinit sht15_probe(struct platform_device *pdev)
data->hwmon_dev = hwmon_device_register(data->dev);
if (IS_ERR(data->hwmon_dev)) {
ret = PTR_ERR(data->hwmon_dev);
goto err_release_gpio_data;
goto err_release_irq;
}
return 0;

err_release_irq:
free_irq(gpio_to_irq(data->pdata->gpio_data), data);
err_release_gpio_data:
gpio_free(data->pdata->gpio_data);
err_release_gpio_sck:
Expand Down

0 comments on commit 560a64a

Please sign in to comment.