summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-02-23 20:14:39 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-02-23 20:14:39 -0600
commit5ef1c7139a39e79f3b7a4365808312f47abfe0e8 (patch)
tree5727992e7297a98e1d6018429c6468db27e6be0d
parent53344c97c1ac474502668dde0e28231820fbf078 (diff)
downloadnuttx-5ef1c7139a39e79f3b7a4365808312f47abfe0e8.tar.gz
nuttx-5ef1c7139a39e79f3b7a4365808312f47abfe0e8.tar.bz2
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
-rw-r--r--nuttx/drivers/can.c12
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);