summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2007-12-19 22:05:07 +0000
committerimp <imp@FreeBSD.org>2007-12-19 22:05:07 +0000
commit46b79678a884735323084fdea993485fe44175c6 (patch)
treeb09d12fd8caa05c7be2c7fbfd19e5cbfd8064f6e /sys/kern/subr_bus.c
parent5aac9e4cdb7d5c0e26dc4c4ce308a99bf263d647 (diff)
downloadFreeBSD-src-46b79678a884735323084fdea993485fe44175c6.zip
FreeBSD-src-46b79678a884735323084fdea993485fe44175c6.tar.gz
When devclass_get_maxunit is passed a NULL, return -1 to indicate that
there's nothing allocated at all yet.
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r--sys/kern/subr_bus.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 420834a..89876d227 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -1220,13 +1220,16 @@ devclass_get_count(devclass_t dc)
* @brief Get the maximum unit number used in a devclass
*
* Note that this is one greater than the highest currently-allocated
- * unit.
+ * unit. If a null devclass_t is passed in, -1 is returned to indicate
+ * that not even the devclass has been allocated yet.
*
* @param dc the devclass to examine
*/
int
devclass_get_maxunit(devclass_t dc)
{
+ if (dc == NULL)
+ return (-1);
return (dc->maxunit);
}
OpenPOWER on IntegriCloud