diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/backlight/ams369fg06.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c index d2494c59e166..3729238e7096 100644 --- a/drivers/video/backlight/ams369fg06.c +++ b/drivers/video/backlight/ams369fg06.c | |||
@@ -482,7 +482,7 @@ static int __devinit ams369fg06_probe(struct spi_device *spi) | |||
482 | struct backlight_device *bd = NULL; | 482 | struct backlight_device *bd = NULL; |
483 | struct backlight_properties props; | 483 | struct backlight_properties props; |
484 | 484 | ||
485 | lcd = kzalloc(sizeof(struct ams369fg06), GFP_KERNEL); | 485 | lcd = devm_kzalloc(&spi->dev, sizeof(struct ams369fg06), GFP_KERNEL); |
486 | if (!lcd) | 486 | if (!lcd) |
487 | return -ENOMEM; | 487 | return -ENOMEM; |
488 | 488 | ||
@@ -492,7 +492,7 @@ static int __devinit ams369fg06_probe(struct spi_device *spi) | |||
492 | ret = spi_setup(spi); | 492 | ret = spi_setup(spi); |
493 | if (ret < 0) { | 493 | if (ret < 0) { |
494 | dev_err(&spi->dev, "spi setup failed.\n"); | 494 | dev_err(&spi->dev, "spi setup failed.\n"); |
495 | goto out_free_lcd; | 495 | return ret; |
496 | } | 496 | } |
497 | 497 | ||
498 | lcd->spi = spi; | 498 | lcd->spi = spi; |
@@ -501,15 +501,13 @@ static int __devinit ams369fg06_probe(struct spi_device *spi) | |||
501 | lcd->lcd_pd = spi->dev.platform_data; | 501 | lcd->lcd_pd = spi->dev.platform_data; |
502 | if (!lcd->lcd_pd) { | 502 | if (!lcd->lcd_pd) { |
503 | dev_err(&spi->dev, "platform data is NULL\n"); | 503 | dev_err(&spi->dev, "platform data is NULL\n"); |
504 | goto out_free_lcd; | 504 | return -EFAULT; |
505 | } | 505 | } |
506 | 506 | ||
507 | ld = lcd_device_register("ams369fg06", &spi->dev, lcd, | 507 | ld = lcd_device_register("ams369fg06", &spi->dev, lcd, |
508 | &ams369fg06_lcd_ops); | 508 | &ams369fg06_lcd_ops); |
509 | if (IS_ERR(ld)) { | 509 | if (IS_ERR(ld)) |
510 | ret = PTR_ERR(ld); | 510 | return PTR_ERR(ld); |
511 | goto out_free_lcd; | ||
512 | } | ||
513 | 511 | ||
514 | lcd->ld = ld; | 512 | lcd->ld = ld; |
515 | 513 | ||
@@ -547,8 +545,6 @@ static int __devinit ams369fg06_probe(struct spi_device *spi) | |||
547 | 545 | ||
548 | out_lcd_unregister: | 546 | out_lcd_unregister: |
549 | lcd_device_unregister(ld); | 547 | lcd_device_unregister(ld); |
550 | out_free_lcd: | ||
551 | kfree(lcd); | ||
552 | return ret; | 548 | return ret; |
553 | } | 549 | } |
554 | 550 | ||
@@ -559,7 +555,6 @@ static int __devexit ams369fg06_remove(struct spi_device *spi) | |||
559 | ams369fg06_power(lcd, FB_BLANK_POWERDOWN); | 555 | ams369fg06_power(lcd, FB_BLANK_POWERDOWN); |
560 | backlight_device_unregister(lcd->bd); | 556 | backlight_device_unregister(lcd->bd); |
561 | lcd_device_unregister(lcd->ld); | 557 | lcd_device_unregister(lcd->ld); |
562 | kfree(lcd); | ||
563 | 558 | ||
564 | return 0; | 559 | return 0; |
565 | } | 560 | } |