Skip to content

Commit

Permalink
drm/sysfs: Do not drop device reference twice
Browse files Browse the repository at this point in the history
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: Thierry Reding <treding@nvidia.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Thierry Reding authored and Dave Airlie committed Oct 30, 2013
1 parent be51e4a commit 9d6104e
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/gpu/drm/drm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
device_remove_file(connector->kdev, &connector_attrs_opt1[i]);
for (i = 0; i < attr_cnt; i++)
device_remove_file(connector->kdev, &connector_attrs[i]);
put_device(connector->kdev);
device_unregister(connector->kdev);

out:
Expand Down Expand Up @@ -472,7 +471,6 @@ void drm_sysfs_connector_remove(struct drm_connector *connector)
for (i = 0; i < ARRAY_SIZE(connector_attrs); i++)
device_remove_file(connector->kdev, &connector_attrs[i]);
sysfs_remove_bin_file(&connector->kdev->kobj, &edid_attr);
put_device(connector->kdev);
device_unregister(connector->kdev);
connector->kdev = NULL;
}
Expand Down

0 comments on commit 9d6104e

Please sign in to comment.