Commit 9d6104e0 authored by Thierry Reding's avatar Thierry Reding Committed by Dave Airlie

drm/sysfs: Do not drop device reference twice

device_unregister() already drops its reference to the struct device, so
explicitly calling put_device() before device_unregister() can cause the
device to have been freed before it can be unregistered.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: default avatarBen Widawsky <ben@bwidawsk.net>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent be51e4a7
...@@ -439,7 +439,6 @@ int drm_sysfs_connector_add(struct drm_connector *connector) ...@@ -439,7 +439,6 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
device_remove_file(connector->kdev, &connector_attrs_opt1[i]); device_remove_file(connector->kdev, &connector_attrs_opt1[i]);
for (i = 0; i < attr_cnt; i++) for (i = 0; i < attr_cnt; i++)
device_remove_file(connector->kdev, &connector_attrs[i]); device_remove_file(connector->kdev, &connector_attrs[i]);
put_device(connector->kdev);
device_unregister(connector->kdev); device_unregister(connector->kdev);
out: out:
...@@ -472,7 +471,6 @@ void drm_sysfs_connector_remove(struct drm_connector *connector) ...@@ -472,7 +471,6 @@ void drm_sysfs_connector_remove(struct drm_connector *connector)
for (i = 0; i < ARRAY_SIZE(connector_attrs); i++) for (i = 0; i < ARRAY_SIZE(connector_attrs); i++)
device_remove_file(connector->kdev, &connector_attrs[i]); device_remove_file(connector->kdev, &connector_attrs[i]);
sysfs_remove_bin_file(&connector->kdev->kobj, &edid_attr); sysfs_remove_bin_file(&connector->kdev->kobj, &edid_attr);
put_device(connector->kdev);
device_unregister(connector->kdev); device_unregister(connector->kdev);
connector->kdev = NULL; connector->kdev = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment