Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308959
b: refs/heads/master
c: 86f6be4
h: refs/heads/master
i:
  308957: d07a7de
  308955: a95a1d0
  308951: 180114e
  308943: 8e9cce1
  308927: 1547bde
v: v3
  • Loading branch information
Jingoo Han authored and Linus Torvalds committed May 29, 2012
1 parent 8f11110 commit 9537140
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 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: ba4a887ac3ff2e3ce876115a3e0828caa9c6f428
refs/heads/master: 86f6be4fae7aeaeb038dc809b232ebe76b2e1dd2
14 changes: 6 additions & 8 deletions trunk/drivers/video/backlight/ld9040.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ static int ld9040_probe(struct spi_device *spi)
struct backlight_device *bd = NULL;
struct backlight_properties props;

lcd = kzalloc(sizeof(struct ld9040), GFP_KERNEL);
lcd = devm_kzalloc(&spi->dev, sizeof(struct ld9040), GFP_KERNEL);
if (!lcd)
return -ENOMEM;

Expand All @@ -717,7 +717,7 @@ static int ld9040_probe(struct spi_device *spi)
ret = spi_setup(spi);
if (ret < 0) {
dev_err(&spi->dev, "spi setup failed.\n");
goto out_free_lcd;
return ret;
}

lcd->spi = spi;
Expand All @@ -726,21 +726,21 @@ static int ld9040_probe(struct spi_device *spi)
lcd->lcd_pd = spi->dev.platform_data;
if (!lcd->lcd_pd) {
dev_err(&spi->dev, "platform data is NULL.\n");
goto out_free_lcd;
return -EFAULT;
}

mutex_init(&lcd->lock);

ret = regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies);
if (ret) {
dev_err(lcd->dev, "Failed to get regulators: %d\n", ret);
goto out_free_lcd;
return ret;
}

ld = lcd_device_register("ld9040", &spi->dev, lcd, &ld9040_lcd_ops);
if (IS_ERR(ld)) {
ret = PTR_ERR(ld);
goto out_free_lcd;
goto out_free_regulator;
}

lcd->ld = ld;
Expand Down Expand Up @@ -782,10 +782,9 @@ static int ld9040_probe(struct spi_device *spi)

out_unregister_lcd:
lcd_device_unregister(lcd->ld);
out_free_lcd:
out_free_regulator:
regulator_bulk_free(ARRAY_SIZE(supplies), supplies);

kfree(lcd);
return ret;
}

Expand All @@ -797,7 +796,6 @@ static int __devexit ld9040_remove(struct spi_device *spi)
backlight_device_unregister(lcd->bd);
lcd_device_unregister(lcd->ld);
regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
kfree(lcd);

return 0;
}
Expand Down

0 comments on commit 9537140

Please sign in to comment.