drm/nouveau: handle backlight_device_register failure
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Sun, 27 Jan 2013 16:13:52 +0000 (17:13 +0100)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 20 Feb 2013 06:00:39 +0000 (16:00 +1000)
Found by smatch.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_backlight.c

index f65b20a..5d94030 100644 (file)
@@ -84,6 +84,8 @@ nv40_backlight_init(struct drm_connector *connector)
        props.max_brightness = 31;
        bd = backlight_device_register("nv_backlight", &connector->kdev, drm,
                                       &nv40_bl_ops, &props);
+       if (IS_ERR(bd))
+               return PTR_ERR(bd);
        drm->backlight = bd;
        bd->props.brightness = nv40_get_intensity(bd);
        backlight_update_status(bd);