diff options
author | px4dev <px4@purgatory.org> | 2013-08-04 19:49:19 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2013-08-04 19:49:19 -0700 |
commit | 1acbbe46d178c7eb2d11a9ba3349d274a3dd1581 (patch) | |
tree | c4f06c9af5491ddddf0165dc211f43b3807f5427 | |
parent | 1fb4705ab7038fb4b135b49c58f14b48f0cfab48 (diff) | |
download | px4-firmware-1acbbe46d178c7eb2d11a9ba3349d274a3dd1581.tar.gz px4-firmware-1acbbe46d178c7eb2d11a9ba3349d274a3dd1581.tar.bz2 px4-firmware-1acbbe46d178c7eb2d11a9ba3349d274a3dd1581.zip |
Make it possible to create a cdev without automatically creating a device node.
-rw-r--r-- | src/drivers/device/cdev.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/drivers/device/cdev.cpp b/src/drivers/device/cdev.cpp index 422321850..47ebcd40a 100644 --- a/src/drivers/device/cdev.cpp +++ b/src/drivers/device/cdev.cpp @@ -111,21 +111,21 @@ CDev::~CDev() int CDev::init() { - int ret = OK; - // base class init first - ret = Device::init(); + int ret = Device::init(); if (ret != OK) goto out; // now register the driver - ret = register_driver(_devname, &fops, 0666, (void *)this); + if (_devname != nullptr) { + ret = register_driver(_devname, &fops, 0666, (void *)this); - if (ret != OK) - goto out; + if (ret != OK) + goto out; - _registered = true; + _registered = true; + } out: return ret; @@ -395,4 +395,4 @@ cdev_poll(struct file *filp, struct pollfd *fds, bool setup) return cdev->poll(filp, fds, setup); } -} // namespace device
\ No newline at end of file +} // namespace device |