Skip to contentSkip to conversation

drm/rockchip: only call drm_fb_helper_hotplug_event if fb_helper present

PATCH In review Heiko Stübner 2 participants 2 messages Jun 2, 2015 – Jun 3, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/rockchip: only call drm_fb_helper_hotplug_event if fb_helper present

Add a check for the presence of fb_helper to rockchip_drm_output_poll_changed() to only call drm_fb_helper_hotplug_event if there is actually a fb_helper available. Without this check I see NULL pointer dereferences when the hdmi hotplug irq fires before the fb_helper got initialized.

---
Fix to variant as seen on at least Exynos, Armada and Omap

 drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +2 -1
index 77d5289..002645b 100644
@@ -162,7 +162,8 @@ static void rockchip_drm_output_poll_changed(struct drm_device *dev)
 	struct rockchip_drm_private *private = dev->dev_private;
 	struct drm_fb_helper *fb_helper = &private->fbdev_helper;
 
-	drm_fb_helper_hotplug_event(fb_helper);
+	if (fb_helper)
+		drm_fb_helper_hotplug_event(fb_helper);
 }
 
 static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = {
Signature · 1 line
2.1.4
#1 lore raw
Quoted 17 lines · Heiko Stübner

Add a check for the presence of fb_helper to rockchip_drm_output_poll_changed() to only call drm_fb_helper_hotplug_event if there is actually a fb_helper available. Without this check I see NULL pointer dereferences when the hdmi hotplug irq fires before the fb_helper got initialized.

---
Fix to variant as seen on at least Exynos, Armada and Omap

  drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +0 -0
index 77d5289..002645b 100644

drivers/gpu/drm/rockchip/rockchip_drm_fb.c static void rockchip_drm_output_poll_changed(struct drm_device *dev) · line 166

Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +2 -1
@@ -162,7 +162,8 @@ static void rockchip_drm_output_poll_changed(struct drm_device *dev)
  	struct rockchip_drm_private *private = dev->dev_private;
  	struct drm_fb_helper *fb_helper = &private->fbdev_helper;
 
-	drm_fb_helper_hotplug_event(fb_helper);
+	if (fb_helper)
+		drm_fb_helper_hotplug_event(fb_helper);

Thanks for the fix, Applied to my drm-next

Quoted 3 lines
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +0 -0
  }
 
  static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = {
Signature · 7 lines
Mark Yao


_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel