6757244 okm_info assumes dip is valid
authorZach Kissel <Zachary.Kissel@Sun.COM>
Mon, 03 Aug 2009 16:11:09 -0400
changeset 10248 7c0b1a92a9bf
parent 10247 27d5d7e9cd70
child 10249 1e37fc71a3af
6757244 okm_info assumes dip is valid
usr/src/uts/sun4u/opl/io/oplkmdrv.c
--- a/usr/src/uts/sun4u/opl/io/oplkmdrv.c	Mon Aug 03 12:46:12 2009 -0700
+++ b/usr/src/uts/sun4u/opl/io/oplkmdrv.c	Mon Aug 03 16:11:09 2009 -0400
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -293,15 +293,20 @@
 int
 okm_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
 {
-	okms_t	*okmsp;
+	okms_t	*okmsp = &okms_global;
 	minor_t	minor;
 	int	ret = DDI_FAILURE;
 
 	switch (infocmd) {
 	case DDI_INFO_DEVT2DEVINFO:
+		/*
+		 * We have the case here where the minor number
+		 * is the same as the instance number. So, just
+		 * make sure we have the right minor node in our
+		 * global state. If we don't, set the result to NULL.
+		 */
 		minor = getminor((dev_t)arg);
-		okmsp = ddi_get_driver_private(dip);
-		if (okmsp == NULL) {
+		if (okmsp->km_inst != minor) {
 			*result = NULL;
 		} else {
 			*result = okmsp->km_dip;