drm/nouveau: Check backlight IDs are >= 0, not > 0
authorLyude Paul <lyude@redhat.com>
Thu, 6 Sep 2018 21:43:21 +0000 (17:43 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Nov 2018 08:19:25 +0000 (09:19 +0100)
commit dc854914999d5d52ac1b31740cb0ea8d89d0372e upstream.

Remember, ida IDs start at 0, not 1!

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/nouveau/nouveau_backlight.c

index 408b955..6dd72bc 100644 (file)
@@ -116,7 +116,7 @@ nv40_backlight_init(struct drm_connector *connector)
                                       &nv40_bl_ops, &props);
 
        if (IS_ERR(bd)) {
-               if (bl_connector.id > 0)
+               if (bl_connector.id >= 0)
                        ida_simple_remove(&bl_ida, bl_connector.id);
                return PTR_ERR(bd);
        }
@@ -249,7 +249,7 @@ nv50_backlight_init(struct drm_connector *connector)
                                       nv_encoder, ops, &props);
 
        if (IS_ERR(bd)) {
-               if (bl_connector.id > 0)
+               if (bl_connector.id >= 0)
                        ida_simple_remove(&bl_ida, bl_connector.id);
                return PTR_ERR(bd);
        }