Skip to content

Commit

Permalink
backlight: blackfin - Fix missing registration failure handling
Browse files Browse the repository at this point in the history
Check newly registered backlight_device for error and properly
return error to parent
Mark struct backlight_ops as const.

Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Acked-by: Mike Frysinger <vapier@gentoo.org> (constify struct backlight_ops)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
  • Loading branch information
Bruno Prémont authored and Richard Purdie committed Mar 16, 2010
1 parent f0af789 commit fa11de0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion drivers/video/bf54x-lq043fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static int bl_get_brightness(struct backlight_device *bd)
return 0;
}

static struct backlight_ops bfin_lq043fb_bl_ops = {
static const struct backlight_ops bfin_lq043fb_bl_ops = {
.get_brightness = bl_get_brightness,
};

Expand Down Expand Up @@ -650,13 +650,21 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
props.max_brightness = 255;
bl_dev = backlight_device_register("bf54x-bl", NULL, NULL,
&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->props.max_contrast = 255, printk(KERN_INFO "Done.\n");
#endif

return 0;

out9:
unregister_framebuffer(fbinfo);
out8:
free_irq(info->irq, info);
out7:
Expand Down
10 changes: 9 additions & 1 deletion drivers/video/bfin-t350mcqb-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static int bl_get_brightness(struct backlight_device *bd)
return 0;
}

static struct backlight_ops bfin_lq043fb_bl_ops = {
static const struct backlight_ops bfin_lq043fb_bl_ops = {
.get_brightness = bl_get_brightness,
};

Expand Down Expand Up @@ -545,13 +545,21 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev)
props.max_brightness = 255;
bl_dev = backlight_device_register("bf52x-bl", NULL, NULL,
&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->props.max_contrast = 255, printk(KERN_INFO "Done.\n");
#endif

return 0;

out9:
unregister_framebuffer(fbinfo);
out8:
free_irq(info->irq, info);
out7:
Expand Down

0 comments on commit fa11de0

Please sign in to comment.