diff options
author | Russell King <rmk@arm.linux.org.uk> | 2012-10-22 15:37:02 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2012-10-22 15:39:08 +0100 |
commit | cee66e4b54e8a9e8098052341f218642a3c2d43c (patch) | |
tree | f84244bddd4edc50b5d20756a9e6c1e48bc42a94 /bmm_lib.c | |
parent | 885f7e61f8603fc3323bc169c179c07624ed0943 (diff) |
fd 0 is a valid fd number
Do not use 0 to indicate that the fd is uninitialized; use -1 instead.
Diffstat (limited to 'bmm_lib.c')
-rw-r--r-- | bmm_lib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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) |