diff options
author | Martin Blapp <mbr@FreeBSD.org> | 2003-05-15 13:06:57 +0000 |
---|---|---|
committer | Martin Blapp <mbr@FreeBSD.org> | 2003-05-15 13:06:57 +0000 |
commit | 8f11d2a89b3a335acb747ed9d96df7dc2f031834 (patch) | |
tree | 78276a04ccdaa9c2f6a60ba81b40221f39d6147f /emulators | |
parent | 6234046b7f25a72538fa82c1d4a603718a2d82c6 (diff) | |
download | ports-8f11d2a89b3a335acb747ed9d96df7dc2f031834.tar.gz ports-8f11d2a89b3a335acb747ed9d96df7dc2f031834.zip |
Fix panic if the rtc module gets loaded twice: Make rtc_dev static
and destroy the device on cleanup.
Submitted by: Orlando Bassotto <orlando.bassotto@ieo-research.it>
Notes
Notes:
svn path=/head/; revision=81032
Diffstat (limited to 'emulators')
-rw-r--r-- | emulators/rtc/files/rtc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/emulators/rtc/files/rtc.c b/emulators/rtc/files/rtc.c index c9063adc8862..6b604ef6f337 100644 --- a/emulators/rtc/files/rtc.c +++ b/emulators/rtc/files/rtc.c @@ -266,11 +266,12 @@ rtc_poll(dev_t dev, int events, struct proc *p) } /* -=-=-=-=-=-=-=-=-= module load/unload stuff -=-=-=-=-=-=-=-=-= */ +static dev_t rtc_dev = NULL; + static int init_module(void) { int error = 0; - dev_t dev; #if __FreeBSD_version < 500104 error = cdevsw_add(&rtc_cdevsw); @@ -278,8 +279,8 @@ init_module(void) return error; #endif - dev = make_dev(&rtc_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, DEVICE_NAME); - if (dev==NULL) + rtc_dev = make_dev(&rtc_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, DEVICE_NAME); + if (rtc_dev==NULL) error = ENOMEM; return error; @@ -298,6 +299,7 @@ cleanup_module(void) DLog(Lfail, "%p busy", sc); return error; } + destroy_dev(rtc_dev); #if __FreeBSD_version < 500104 error = cdevsw_remove(&rtc_cdevsw); #endif |