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 f65b20a375f68ce1c5461a49aa5bc5cc8187e65f..5d940302d2aae5756e2b5faaa33264a92d91c1fd 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);