[PATCHv6 1/6] drm/core: Allow drivers allocate a subclass of struct drm_framebuffer
Emil Velikov
emil.l.velikov at gmail.com
Tue Mar 3 16:56:49 UTC 2020
Hi Andrzej,
On Tue, 3 Mar 2020 at 12:01, Andrzej Pietrasiewicz
<andrzej.p at collabora.com> wrote:
> * Returns:
> * Pointer to a &drm_framebuffer on success or an error pointer on failure.
> */
> struct drm_framebuffer *
> -drm_gem_fb_create_with_funcs(struct drm_device *dev, struct drm_file *file,
> - const struct drm_mode_fb_cmd2 *mode_cmd,
> - const struct drm_framebuffer_funcs *funcs)
> +drm_gem_fb_init_with_funcs(struct drm_device *dev, struct drm_framebuffer *fb,
> +drm_gem_fb_create_with_funcs(struct drm_device *dev, struct drm_file *file,
> + const struct drm_mode_fb_cmd2 *mode_cmd,
> + const struct drm_framebuffer_funcs *funcs)
> +{
> + struct drm_framebuffer *fb, *ret;
> +
> + fb = kzalloc(sizeof(*fb), GFP_KERNEL);
> + if (!fb)
> + return ERR_PTR(-ENOMEM);
> +
> + ret = drm_gem_fb_init_with_funcs(dev, fb, file, mode_cmd, funcs);
> + if (IS_ERR_OR_NULL(ret))
We can make this "IS_ERR", since the function never returns NULL.
The documentation explicitly states that error pointer is returned.
-Emil
More information about the dri-devel
mailing list