drm/radeon: check the alloc_workqueue return value in radeon_crtc_init()
authorjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:34:47 +0000 (01:34 +0000)
committerjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:34:47 +0000 (01:34 +0000)
From Yang Yingliang
0b813a6a0087451cb702b6eb841f10856f49d088 in linux-6.6.y/6.6.14
7a2464fac80d42f6f8819fed97a553e9c2f43310 in mainline linux

sys/dev/pci/drm/radeon/radeon_display.c

index e475602..94132c3 100644 (file)
@@ -687,11 +687,16 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
        if (radeon_crtc == NULL)
                return;
 
+       radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0);
+       if (!radeon_crtc->flip_queue) {
+               kfree(radeon_crtc);
+               return;
+       }
+
        drm_crtc_init(dev, &radeon_crtc->base, &radeon_crtc_funcs);
 
        drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
        radeon_crtc->crtc_id = index;
-       radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0);
        rdev->mode_info.crtcs[index] = radeon_crtc;
 
        if (rdev->family >= CHIP_BONAIRE) {