Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308963
b: refs/heads/master
c: d073adc
h: refs/heads/master
i:
  308961: 9fcde95
  308959: 9537140
v: v3
  • Loading branch information
Jingoo Han authored and Linus Torvalds committed May 29, 2012
1 parent 25578d7 commit edbed4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 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: 541f936f5d3993c5bbed33bdb53acd6de2403b04
refs/heads/master: d073adc5caf03a928a230baf2d8a86b1f9a03710
21 changes: 6 additions & 15 deletions trunk/drivers/video/backlight/tdo24m.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,17 @@ static int __devinit tdo24m_probe(struct spi_device *spi)
if (err)
return err;

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

lcd->spi_dev = spi;
lcd->power = FB_BLANK_POWERDOWN;
lcd->mode = MODE_VGA; /* default to VGA */

lcd->buf = kmalloc(TDO24M_SPI_BUFF_SIZE, GFP_KERNEL);
if (lcd->buf == NULL) {
kfree(lcd);
lcd->buf = devm_kzalloc(&spi->dev, TDO24M_SPI_BUFF_SIZE, GFP_KERNEL);
if (lcd->buf == NULL)
return -ENOMEM;
}

m = &lcd->msg;
x = &lcd->xfer;
Expand All @@ -383,15 +381,13 @@ static int __devinit tdo24m_probe(struct spi_device *spi)
break;
default:
dev_err(&spi->dev, "Unsupported model");
goto out_free;
return -EINVAL;
}

lcd->lcd_dev = lcd_device_register("tdo24m", &spi->dev,
lcd, &tdo24m_ops);
if (IS_ERR(lcd->lcd_dev)) {
err = PTR_ERR(lcd->lcd_dev);
goto out_free;
}
if (IS_ERR(lcd->lcd_dev))
return PTR_ERR(lcd->lcd_dev);

dev_set_drvdata(&spi->dev, lcd);
err = tdo24m_power(lcd, FB_BLANK_UNBLANK);
Expand All @@ -402,9 +398,6 @@ static int __devinit tdo24m_probe(struct spi_device *spi)

out_unregister:
lcd_device_unregister(lcd->lcd_dev);
out_free:
kfree(lcd->buf);
kfree(lcd);
return err;
}

Expand All @@ -414,8 +407,6 @@ static int __devexit tdo24m_remove(struct spi_device *spi)

tdo24m_power(lcd, FB_BLANK_POWERDOWN);
lcd_device_unregister(lcd->lcd_dev);
kfree(lcd->buf);
kfree(lcd);

return 0;
}
Expand Down

0 comments on commit edbed4c

Please sign in to comment.