Commit fa11de0a authored by Bruno Prémont's avatar Bruno Prémont Committed by Richard Purdie

backlight: blackfin - Fix missing registration failure handling

Check newly registered backlight_device for error and properly
return error to parent
Mark struct backlight_ops as const.
Signed-off-by: default avatarBruno Prémont <bonbons@linux-vserver.org>
Acked-by: Mike Frysinger <vapier@gentoo.org> (constify struct backlight_ops)
Signed-off-by: default avatarRichard Purdie <rpurdie@linux.intel.com>
parent f0af7899
...@@ -433,7 +433,7 @@ static int bl_get_brightness(struct backlight_device *bd) ...@@ -433,7 +433,7 @@ static int bl_get_brightness(struct backlight_device *bd)
return 0; return 0;
} }
static struct backlight_ops bfin_lq043fb_bl_ops = { static const struct backlight_ops bfin_lq043fb_bl_ops = {
.get_brightness = bl_get_brightness, .get_brightness = bl_get_brightness,
}; };
...@@ -650,6 +650,12 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev) ...@@ -650,6 +650,12 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
props.max_brightness = 255; props.max_brightness = 255;
bl_dev = backlight_device_register("bf54x-bl", NULL, NULL, bl_dev = backlight_device_register("bf54x-bl", NULL, NULL,
&bfin_lq043fb_bl_ops, &props); &bfin_lq043fb_bl_ops, &props);
if (IS_ERR(bl_dev)) {
printk(KERN_ERR DRIVER_NAME
": unable to register backlight.\n");
ret = -EINVAL;
goto out9;
}
lcd_dev = lcd_device_register(DRIVER_NAME, &pdev->dev, NULL, &bfin_lcd_ops); lcd_dev = lcd_device_register(DRIVER_NAME, &pdev->dev, NULL, &bfin_lcd_ops);
lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n"); lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n");
...@@ -657,6 +663,8 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev) ...@@ -657,6 +663,8 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
return 0; return 0;
out9:
unregister_framebuffer(fbinfo);
out8: out8:
free_irq(info->irq, info); free_irq(info->irq, info);
out7: out7:
......
...@@ -352,7 +352,7 @@ static int bl_get_brightness(struct backlight_device *bd) ...@@ -352,7 +352,7 @@ static int bl_get_brightness(struct backlight_device *bd)
return 0; return 0;
} }
static struct backlight_ops bfin_lq043fb_bl_ops = { static const struct backlight_ops bfin_lq043fb_bl_ops = {
.get_brightness = bl_get_brightness, .get_brightness = bl_get_brightness,
}; };
...@@ -545,6 +545,12 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev) ...@@ -545,6 +545,12 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev)
props.max_brightness = 255; props.max_brightness = 255;
bl_dev = backlight_device_register("bf52x-bl", NULL, NULL, bl_dev = backlight_device_register("bf52x-bl", NULL, NULL,
&bfin_lq043fb_bl_ops, &props); &bfin_lq043fb_bl_ops, &props);
if (IS_ERR(bl_dev)) {
printk(KERN_ERR DRIVER_NAME
": unable to register backlight.\n");
ret = -EINVAL;
goto out9;
}
lcd_dev = lcd_device_register(DRIVER_NAME, NULL, &bfin_lcd_ops); lcd_dev = lcd_device_register(DRIVER_NAME, NULL, &bfin_lcd_ops);
lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n"); lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n");
...@@ -552,6 +558,8 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev) ...@@ -552,6 +558,8 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev)
return 0; return 0;
out9:
unregister_framebuffer(fbinfo);
out8: out8:
free_irq(info->irq, info); free_irq(info->irq, info);
out7: out7:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment