@@ -194,7 +194,7 @@ static int xlnx_fbdev_create(struct drm_fb_helper *fb_helper,
struct drm_framebuffer *fb;
unsigned int bytes_per_pixel;
unsigned long offset;
- struct fb_info *fbi;
+ struct fb_info *fbi = fb_helper->info;
u32 format;
const struct drm_format_info *info;
size_t bytes;
@@ -213,13 +213,6 @@ static int xlnx_fbdev_create(struct drm_fb_helper *fb_helper,
if (IS_ERR(obj))
return PTR_ERR(obj);
- fbi = framebuffer_alloc(0, drm->dev);
- if (!fbi) {
- dev_err(drm->dev, "Failed to allocate framebuffer info.\n");
- ret = -ENOMEM;
- goto err_drm_gem_cma_free_object;
- }
-
/* Override the depth given by fb helper with current format value */
format = xlnx_get_format(drm);
info = drm_format_info(format);
@@ -231,20 +224,13 @@ static int xlnx_fbdev_create(struct drm_fb_helper *fb_helper,
if (IS_ERR(fbdev->fb)) {
dev_err(drm->dev, "Failed to allocate DRM framebuffer.\n");
ret = PTR_ERR(fbdev->fb);
- goto err_framebuffer_release;
+ goto err_drm_gem_cma_free_object;
}
fb = fbdev->fb;
fb_helper->fb = fb;
- fb_helper->info = fbi;
fbi->fbops = &xlnx_fbdev_ops;
- ret = fb_alloc_cmap(&fbi->cmap, 256, 0);
- if (ret) {
- dev_err(drm->dev, "Failed to allocate color map.\n");
- goto err_fb_destroy;
- }
-
drm_fb_helper_fill_info(fbi, fb_helper, size);
fbi->var.yres = fb->height / fbdev->vres_mult;
@@ -259,11 +245,6 @@ static int xlnx_fbdev_create(struct drm_fb_helper *fb_helper,
return 0;
-err_fb_destroy:
- drm_framebuffer_unregister_private(fb);
- drm_gem_fb_destroy(fb);
-err_framebuffer_release:
- framebuffer_release(fbi);
err_drm_gem_cma_free_object:
drm_gem_dma_free(obj);
return ret;
BugLink: https://bugs.launchpad.net/bugs/2171424 Commit 238b6bfbb648 ("drm/fb-helper: Allocate and release fb_info in single place") moved the fb_info and colour map allocation into the common DRM fb-helper, before the driver's fb_probe callback is called. The helper also releases both on failure. The Xilinx fb_probe callback still allocates a separate fb_info and replaces fb_helper->info with it. The helper keeps its original pointer and registers that object instead of the one initialized by the driver. Its fbops pointer remains NULL, causing an Oops in fbcon_open() when it dereferences info->fbops->owner. On KV260 this also leaves console tasks blocked and prevents normal serial login and SSH access. Use the fb_info and colour map already allocated by the helper. Remove the duplicate allocations, the reassignment of fb_helper->info and the corresponding error handling. Keep the GEM object cleanup on framebuffer creation failure. The Xilinx DRM driver is not in mainline. The Xilinx downstream tree (https://github.com/Xilinx/linux-xlnx) is based on a kernel that does not include the fb-helper change yet, so there is no fix to cherry-pick. Fixes: 238b6bfbb648 ("drm/fb-helper: Allocate and release fb_info in single place") Signed-off-by: Krystian Kaniewski <krystian.kaniewski@canonical.com> --- drivers/gpu/drm/xlnx/xlnx_fb.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-)