diff mbox series

[1/2] drm/fbdev-helper: fail if driver provides no fbdev/fb probe functions

Message ID 20241003092826.1942901-2-m.szyprowski@samsung.com (mailing list archive)
State New, archived
Headers show
Series drm: Two fixes for the 'Provide client setup helper and convert drivers' patchset | expand

Commit Message

Marek Szyprowski Oct. 3, 2024, 9:28 a.m. UTC
If caller doesn't provide driver->fbdev_probe nor funcs->fb_probe, then
fail early instead of causing potential NULL pointer dereference, because
fb_helper->fb won't be initialized in such case.

Fixes: 5d08c44e47b9 ("drm/fbdev: Add memory-agnostic fbdev client")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index d5e8994345bb..fc260832326c 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1635,6 +1635,9 @@  static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper)
 		ret = dev->driver->fbdev_probe(fb_helper, &sizes);
 	else if (fb_helper->funcs)
 		ret = fb_helper->funcs->fb_probe(fb_helper, &sizes);
+	else
+		ret = -ENODEV;
+
 	if (ret < 0)
 		return ret;