drm/sun4i: Set device driver data at bind time for use in unbind

This change “drm/sun4i: Set device driver data at bind time for use in unbind” (commit 02b92ad) in Linux kernel is authored by Paul Kocialkowski <paul.kocialkowski [at] bootlin.com> on Thu Apr 18 15:27:26 2019 +0200.

Description of "drm/sun4i: Set device driver data at bind time for use in unbind"

The change “drm/sun4i: Set device driver data at bind time for use in unbind” introduces changes as follows.

drm/sun4i: Set device driver data at bind time for use in unbind

Our sun4i_drv_unbind gets the drm device using dev_get_drvdata.
However, that driver data is never set in sun4i_drv_bind.

Set it there to avoid getting a NULL pointer at unbind time.

Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190418132727.5128-3-paul.kocialkowski@bootlin.com

Linux kernel releases containing commit 02b92ad

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "drm/sun4i: Set device driver data at bind time for use in unbind"

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/gpu/drm/sun4i/sun4i_drv.c | 2 ++
 1 file changed, 2 insertions(+)
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index c5871b15714f..8abaabde08ab 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -86,6 +86,8 @@ static int sun4i_drv_bind(struct device *dev)
 		ret = -ENOMEM;
 		goto free_drm;
 	}
+
+	dev_set_drvdata(dev, drm);
 	drm->dev_private = drv;
 	INIT_LIST_HEAD(&drv->frontend_list);
 	INIT_LIST_HEAD(&drv->engine_list);

The commit for this change in Linux stable tree is 02b92ad (patch).

Last modified: 2020/02/08