Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm: Simplify drmm_alloc_ordered_workqueue return

Rather than returning ERR_PTR or NULL on failure, replace the NULL
return with ERR_PTR(-ENOMEM). This simplifies error handling at the
caller. While here, add kernel documentation for
drmm_alloc_ordered_workqueue.

Cc: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Link: https://lore.kernel.org/r/20250702232831.3271328-2-matthew.brost@intel.com

+13 -4
-2
drivers/gpu/drm/vkms/vkms_crtc.c
··· 302 302 vkms_out->composer_workq = drmm_alloc_ordered_workqueue(dev, "vkms_composer", 0); 303 303 if (IS_ERR(vkms_out->composer_workq)) 304 304 return ERR_CAST(vkms_out->composer_workq); 305 - if (!vkms_out->composer_workq) 306 - return ERR_PTR(-ENOMEM); 307 305 308 306 return vkms_out; 309 307 }
+13 -2
include/drm/drm_managed.h
··· 129 129 130 130 void __drmm_workqueue_release(struct drm_device *device, void *wq); 131 131 132 + /** 133 + * drmm_alloc_ordered_workqueue - &drm_device managed alloc_ordered_workqueue() 134 + * @dev: DRM device 135 + * @fmt: printf format for the name of the workqueue 136 + * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful) 137 + * @args: args for @fmt 138 + * 139 + * This is a &drm_device-managed version of alloc_ordered_workqueue(). The 140 + * allocated workqueue is automatically destroyed on the final drm_dev_put(). 141 + * 142 + * Returns: workqueue on success, negative ERR_PTR otherwise. 143 + */ 132 144 #define drmm_alloc_ordered_workqueue(dev, fmt, flags, args...) \ 133 145 ({ \ 134 146 struct workqueue_struct *wq = alloc_ordered_workqueue(fmt, flags, ##args); \ 135 147 wq ? ({ \ 136 148 int ret = drmm_add_action_or_reset(dev, __drmm_workqueue_release, wq); \ 137 149 ret ? ERR_PTR(ret) : wq; \ 138 - }) : \ 139 - wq; \ 150 + }) : ERR_PTR(-ENOMEM); \ 140 151 }) 141 152 142 153 #endif