Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit bc3954b8 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

staging: comedi: simplify comedi_set_hw_dev()



Since `get_device()` and `put_device()` can take a NULL device
parameter, `comedi_set_hw_dev()` can be simplified to always call
`get_device()` for the new, possibly NULL hardware device, and
`put_device()` for the old, possibly NULL hardware device.  As long as
we do it in that order, there shouldn't be any problem with
`kref_release()` getting called unexpectedly when the new hardware
device is the old hardware device.

Simplify `comedi_set_hw_dev()` and update the comment because the
function is used for additional purposes since the old comment was
written.

Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 10464060
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment