summaryrefslogtreecommitdiff
path: root/tools/perf/scripts
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2013-12-11 14:51:02 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-17 13:09:43 -0800
commit8f988d8784e3fa4bb50dabeec516cd3fbdb4ea73 (patch)
treef211190884237decdecc0e1715b37343bc877369 /tools/perf/scripts
parenta3b22220a48bd14c9ba4ca8d051b0c92d5bc3866 (diff)
staging/comedi: keep reference to class device after destroyed
When a dynamically allocated `struct comedi_device` gets automatically unconfigured by a call to `comedi_auto_unconfig()` from a lower-level driver's bus removal function (e.g. when a USB device is disconnected), the class device in `dev->class_dev` (where `dev` points to the `struct comedi_device`) is destroyed by a call to `device_destroy()` that matches a previous call to `device_create()`. However, if the `struct comedi_device` is still associated with an open file object, the now invalid `dev->class_dev` pointer may still be passed to `dev_printk()` (via `dev_dbg()` etc.), producing bogus output or worse. To fix this, call `get_device()` on the class device if `device_create()` was successful. Add a matching call to `put_device()` in `comedi_dev_kref_release()` when the `struct comedi_device` is freed. The calls to `dev_dbg()` etc. after the call to `device_destroy()` will still produce valid output, although the device will have been unregistered in sysfs. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/perf/scripts')
0 files changed, 0 insertions, 0 deletions