Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308958
b: refs/heads/master
c: ba4a887
h: refs/heads/master
v: v3
  • Loading branch information
Jingoo Han authored and Linus Torvalds committed May 29, 2012
1 parent d07a7de commit 8f11110
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 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: 9828eb09bf5a450bd40a6931a751a122a4c66e2b
refs/heads/master: ba4a887ac3ff2e3ce876115a3e0828caa9c6f428
25 changes: 11 additions & 14 deletions trunk/drivers/video/backlight/l4f00242t03.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
return -EINVAL;
}

priv = kzalloc(sizeof(struct l4f00242t03_priv), GFP_KERNEL);
priv = devm_kzalloc(&spi->dev, sizeof(struct l4f00242t03_priv),
GFP_KERNEL);

if (priv == NULL) {
dev_err(&spi->dev, "No memory for this device.\n");
Expand All @@ -179,38 +180,38 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
if (ret) {
dev_err(&spi->dev,
"Unable to get the lcd l4f00242t03 reset gpio.\n");
goto err;
return ret;
}

ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW,
"lcd l4f00242t03 data enable");
if (ret) {
dev_err(&spi->dev,
"Unable to get the lcd l4f00242t03 data en gpio.\n");
goto err2;
goto err;
}

priv->io_reg = regulator_get(&spi->dev, "vdd");
if (IS_ERR(priv->io_reg)) {
ret = PTR_ERR(priv->io_reg);
dev_err(&spi->dev, "%s: Unable to get the IO regulator\n",
__func__);
goto err3;
goto err2;
}

priv->core_reg = regulator_get(&spi->dev, "vcore");
if (IS_ERR(priv->core_reg)) {
ret = PTR_ERR(priv->core_reg);
dev_err(&spi->dev, "%s: Unable to get the core regulator\n",
__func__);
goto err4;
goto err3;
}

priv->ld = lcd_device_register("l4f00242t03",
&spi->dev, priv, &l4f_ops);
if (IS_ERR(priv->ld)) {
ret = PTR_ERR(priv->ld);
goto err5;
goto err4;
}

/* Init the LCD */
Expand All @@ -222,16 +223,14 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)

return 0;

err5:
regulator_put(priv->core_reg);
err4:
regulator_put(priv->io_reg);
regulator_put(priv->core_reg);
err3:
gpio_free(pdata->data_enable_gpio);
regulator_put(priv->io_reg);
err2:
gpio_free(pdata->reset_gpio);
gpio_free(pdata->data_enable_gpio);
err:
kfree(priv);
gpio_free(pdata->reset_gpio);

return ret;
}
Expand All @@ -252,8 +251,6 @@ static int __devexit l4f00242t03_remove(struct spi_device *spi)
regulator_put(priv->io_reg);
regulator_put(priv->core_reg);

kfree(priv);

return 0;
}

Expand Down

0 comments on commit 8f11110

Please sign in to comment.