From: algea.cao Date: Tue, 2 May 2017 01:03:19 +0000 (+0800) Subject: drm: bridge: dw-hdmi: fixup kernel crash when reboot with hdmi connected X-Git-Tag: release-20171130_firefly~4^2~475 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d3a6dbe68206903e77867487f7f349cd7dea1306;p=firefly-linux-kernel-4.4.55.git drm: bridge: dw-hdmi: fixup kernel crash when reboot with hdmi connected when other devices bind failed,drm will unbind and re-bind all devices. if don't cancel the delayed work but flush and destroy workqueue directly, kernel point is likely to become NULL. Change-Id: Ib48704186ee298cbd4daac1cdbbac5fb3906b6bb Signed-off-by: algea.cao --- diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c index 7feb580bce1f..c4af0fc3a17a 100644 --- a/drivers/gpu/drm/bridge/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/dw-hdmi.c @@ -2828,6 +2828,13 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data) { struct dw_hdmi *hdmi = dev_get_drvdata(dev); + if (hdmi->irq) + disable_irq(hdmi->irq); + + cancel_delayed_work(&hdmi->work); + flush_workqueue(hdmi->workqueue); + destroy_workqueue(hdmi->workqueue); + if (hdmi->audio && !IS_ERR(hdmi->audio)) platform_device_unregister(hdmi->audio); @@ -2847,9 +2854,6 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data) i2c_del_adapter(&hdmi->i2c->adap); else i2c_put_adapter(hdmi->ddc); - - flush_workqueue(hdmi->workqueue); - destroy_workqueue(hdmi->workqueue); } EXPORT_SYMBOL_GPL(dw_hdmi_unbind);