aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/backlight/corgi_lcd.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 6dab13fe562e..23d732677ba1 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -544,7 +544,7 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi)
544 return -EINVAL; 544 return -EINVAL;
545 } 545 }
546 546
547 lcd = kzalloc(sizeof(struct corgi_lcd), GFP_KERNEL); 547 lcd = devm_kzalloc(&spi->dev, sizeof(struct corgi_lcd), GFP_KERNEL);
548 if (!lcd) { 548 if (!lcd) {
549 dev_err(&spi->dev, "failed to allocate memory\n"); 549 dev_err(&spi->dev, "failed to allocate memory\n");
550 return -ENOMEM; 550 return -ENOMEM;
@@ -554,10 +554,9 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi)
554 554
555 lcd->lcd_dev = lcd_device_register("corgi_lcd", &spi->dev, 555 lcd->lcd_dev = lcd_device_register("corgi_lcd", &spi->dev,
556 lcd, &corgi_lcd_ops); 556 lcd, &corgi_lcd_ops);
557 if (IS_ERR(lcd->lcd_dev)) { 557 if (IS_ERR(lcd->lcd_dev))
558 ret = PTR_ERR(lcd->lcd_dev); 558 return PTR_ERR(lcd->lcd_dev);
559 goto err_free_lcd; 559
560 }
561 lcd->power = FB_BLANK_POWERDOWN; 560 lcd->power = FB_BLANK_POWERDOWN;
562 lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA; 561 lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA;
563 562
@@ -591,8 +590,6 @@ err_unregister_bl:
591 backlight_device_unregister(lcd->bl_dev); 590 backlight_device_unregister(lcd->bl_dev);
592err_unregister_lcd: 591err_unregister_lcd:
593 lcd_device_unregister(lcd->lcd_dev); 592 lcd_device_unregister(lcd->lcd_dev);
594err_free_lcd:
595 kfree(lcd);
596 return ret; 593 return ret;
597} 594}
598 595
@@ -613,7 +610,6 @@ static int __devexit corgi_lcd_remove(struct spi_device *spi)
613 610
614 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); 611 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN);
615 lcd_device_unregister(lcd->lcd_dev); 612 lcd_device_unregister(lcd->lcd_dev);
616 kfree(lcd);
617 613
618 return 0; 614 return 0;
619} 615}