diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-02-23 20:14:39 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-02-23 20:14:39 -0600 |
commit | 5ef1c7139a39e79f3b7a4365808312f47abfe0e8 (patch) | |
tree | 5727992e7297a98e1d6018429c6468db27e6be0d /nuttx/drivers | |
parent | 53344c97c1ac474502668dde0e28231820fbf078 (diff) | |
download | px4-nuttx-5ef1c7139a39e79f3b7a4365808312f47abfe0e8.tar.gz px4-nuttx-5ef1c7139a39e79f3b7a4365808312f47abfe0e8.tar.bz2 px4-nuttx-5ef1c7139a39e79f3b7a4365808312f47abfe0e8.zip |
CAN driver: Another Ooops... Cannot save the updated driver open count if the we fail to initialize the CAN driver, causing the open to fail
Diffstat (limited to 'nuttx/drivers')
-rw-r--r-- | nuttx/drivers/can.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/nuttx/drivers/can.c b/nuttx/drivers/can.c index 6eb98cc0a..d36d7e00a 100644 --- a/nuttx/drivers/can.c +++ b/nuttx/drivers/can.c @@ -185,14 +185,20 @@ static int can_open(FAR struct file *filep) /* Finally, Enable the CAN RX interrupt */ dev_rxint(dev, true); + + /* Save the new open count on success */ + + dev->cd_ocount = 1; } irqrestore(flags); } + else + { + /* Save the incremented open count on success */ - /* Save the new open count on success */ - - dev->cd_ocount = tmp; + dev->cd_ocount = tmp; + } } sem_post(&dev->cd_closesem); |