diff --git a/fl2000_drm.c b/fl2000_drm.c index c5429a5..e7f7f93 100644 --- a/fl2000_drm.c +++ b/fl2000_drm.c @@ -546,7 +546,7 @@ static struct component_master_ops fl2000_master_ops = { * * @return 0 on success, negative value on error */ -int fl2000_drm_init(sstruct usb_device *usb_dev) +int fl2000_drm_init(struct usb_device *usb_dev) { int ret; struct fl2000_drm_if *drm_if; @@ -627,9 +627,18 @@ int fl2000_drm_init(sstruct usb_device *usb_dev) void fl2000_drm_cleanup(struct usb_device *usb_dev) { + struct drm_device *drm; + struct fl2000_drm_if *drm_if = dev_get_drvdata(&usb_dev->dev); + + if (!drm_if) { + dev_err(&usb_dev->dev, "Cannot find DRM structure!"); + return; + } + dev_set_drvdata(&usb_dev->dev, NULL); component_master_del(&usb_dev->dev, &fl2000_master_ops); + drm = &drm_if->drm; drm_mode_config_cleanup(drm); drm_dev_put(drm); }