diff options
-rw-r--r-- | sys/kern/subr_devstat.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index f7a52ff..6a51745 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include <machine/atomic.h> static int devstat_num_devs; -static long devstat_generation; +static long devstat_generation = 1; static int devstat_version = DEVSTAT_VERSION; static int devstat_current_devnumber; static struct mtx devstat_mutex; @@ -364,9 +364,6 @@ sysctl_devstat(SYSCTL_HANDLER_ARGS) mtx_assert(&devstat_mutex, MA_NOTOWNED); - if (devstat_num_devs == 0) - return(EINVAL); - /* * XXX devstat_generation should really be "volatile" but that * XXX freaks out the sysctl macro below. The places where we @@ -379,6 +376,9 @@ sysctl_devstat(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, &mygen, sizeof(mygen)); + if (devstat_num_devs == 0) + return(0); + if (error != 0) return (error); |