Permalink
Browse files

libdce: fix refcounting in init/deinit

  • Loading branch information...
1 parent 35eb1b6 commit 36c8db775701a3779a17b78c7b8da20b5b43a96f Alessandro Decina committed with Rob Clark May 15, 2012
Showing with 2 additions and 6 deletions.
  1. +2 −6 libdce.c
View
@@ -404,7 +404,7 @@ static int init(void)
pthread_mutex_lock(&mutex);
- if (count > 0) {
+ if (count++ > 0) {
goto out;
}
@@ -496,8 +496,6 @@ static int init(void)
ioctl_base = req.ioctl_base;
dev = omap_device_new(fd);
-
- count++;
}
out:
@@ -509,9 +507,7 @@ static void deinit(void)
{
pthread_mutex_lock(&mutex);
- count--;
-
- if (count > 0) {
+ if (--count > 0) {
goto out;
}

0 comments on commit 36c8db7

Please sign in to comment.