summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2012-10-22 15:37:02 +0100
committerRussell King <rmk@arm.linux.org.uk>2012-10-22 15:39:08 +0100
commitcee66e4b54e8a9e8098052341f218642a3c2d43c (patch)
treef84244bddd4edc50b5d20756a9e6c1e48bc42a94
parent885f7e61f8603fc3323bc169c179c07624ed0943 (diff)
fd 0 is a valid fd number
Do not use 0 to indicate that the fd is uninitialized; use -1 instead.
-rw-r--r--bmm_lib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bmm_lib.c b/bmm_lib.c
index 073b213..c4d56f6 100644
--- a/bmm_lib.c
+++ b/bmm_lib.c
@@ -29,12 +29,12 @@
#define pr_debug(fmt, arg...) do { } while(0)
#endif
-static int bmm_fd = 0;
+static int bmm_fd = -1;
int bmm_init()
{
/* attempt to open the BMM driver */
- if(bmm_fd <= 0)
+ if(bmm_fd < 0)
bmm_fd = open(BMM_DEVICE_FILE, O_RDWR);
/* if the open failed, try to mount the driver */
@@ -50,9 +50,9 @@ int bmm_init()
void bmm_exit()
{
- if(bmm_fd > 0)
+ if(bmm_fd >= 0)
close(bmm_fd);
- bmm_fd = 0;
+ bmm_fd = -1;
}
void *bmm_malloc(unsigned long size, int attr)