Prev: [PATCH 09/43] acpi: use queue_work_on() instead of binding workqueue worker to cpu0
Next: [PATCH] io: remove padding from io_context on 64bit builds
From: Bruno Prémont on 26 Feb 2010 07:30 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(a)linux-vserver.org> Acked-by: Mike Frysinger <vapier(a)gentoo.org> (constify struct backlight_ops) --- drivers/video/bf54x-lq043fb.c | 10 +++++++++- drivers/video/bfin-t350mcqb-fb.c | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index db4e6f7..a589216 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c @@ -463,7 +463,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, }; @@ -678,6 +678,12 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev) bl_dev = backlight_device_register("bf54x-bl", NULL, NULL, &bfin_lq043fb_bl_ops); + if (IS_ERR(bl_dev)) { + printk(KERN_ERR DRIVER_NAME + ": unable to register backlight.\n"); + ret = -EINVAL; + goto out9; + } bl_dev->props.max_brightness = 255; lcd_dev = lcd_device_register(DRIVER_NAME, &pdev->dev, NULL, &bfin_lcd_ops); @@ -686,6 +692,8 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev) return 0; +out9: + unregister_framebuffer(fbinfo); out8: free_irq(info->irq, info); out7: diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c index bc204c6..fe1492b 100644 --- a/drivers/video/bfin-t350mcqb-fb.c +++ b/drivers/video/bfin-t350mcqb-fb.c @@ -381,7 +381,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, }; @@ -572,6 +572,12 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev) bl_dev = backlight_device_register("bf52x-bl", NULL, NULL, &bfin_lq043fb_bl_ops); + if (IS_ERR(bl_dev)) { + printk(KERN_ERR DRIVER_NAME + ": unable to register backlight.\n"); + ret = -EINVAL; + goto out9; + } bl_dev->props.max_brightness = 255; lcd_dev = lcd_device_register(DRIVER_NAME, NULL, &bfin_lcd_ops); @@ -580,6 +586,8 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev) return 0; +out9: + unregister_framebuffer(fbinfo); out8: free_irq(info->irq, info); out7: -- 1.6.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |