Commit f73ab51b authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/fbdev-generic: Initialize fb-helper structure in generic setup

Initialize the fb-helper structure immediately after its allocation
in drm_fbdev_generic_setup(). That will make it easier to fill it with
driver-specific values, such as the preferred BPP.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125200415.14123-5-tzimmermann@suse.de
parent 4825797c
No related merge requests found
...@@ -385,8 +385,6 @@ static int drm_fbdev_client_hotplug(struct drm_client_dev *client) ...@@ -385,8 +385,6 @@ static int drm_fbdev_client_hotplug(struct drm_client_dev *client)
if (dev->fb_helper) if (dev->fb_helper)
return drm_fb_helper_hotplug_event(dev->fb_helper); return drm_fb_helper_hotplug_event(dev->fb_helper);
drm_fb_helper_prepare(dev, fb_helper, &drm_fb_helper_generic_funcs);
ret = drm_fb_helper_init(dev, fb_helper); ret = drm_fb_helper_init(dev, fb_helper);
if (ret) if (ret)
goto err; goto err;
...@@ -456,12 +454,12 @@ void drm_fbdev_generic_setup(struct drm_device *dev, ...@@ -456,12 +454,12 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL); fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
if (!fb_helper) if (!fb_helper)
return; return;
drm_fb_helper_prepare(dev, fb_helper, &drm_fb_helper_generic_funcs);
ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs); ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs);
if (ret) { if (ret) {
kfree(fb_helper);
drm_err(dev, "Failed to register client: %d\n", ret); drm_err(dev, "Failed to register client: %d\n", ret);
return; goto err_drm_client_init;
} }
/* /*
...@@ -484,5 +482,12 @@ void drm_fbdev_generic_setup(struct drm_device *dev, ...@@ -484,5 +482,12 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
drm_dbg_kms(dev, "client hotplug ret=%d\n", ret); drm_dbg_kms(dev, "client hotplug ret=%d\n", ret);
drm_client_register(&fb_helper->client); drm_client_register(&fb_helper->client);
return;
err_drm_client_init:
drm_fb_helper_unprepare(fb_helper);
kfree(fb_helper);
return;
} }
EXPORT_SYMBOL(drm_fbdev_generic_setup); EXPORT_SYMBOL(drm_fbdev_generic_setup);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment