rem: add_val(&val_list, 1, (caddr_t)(uintptr_t)ival);
add: tail = add_val(&val_list, tail, 1, (caddr_t)(uintptr_t)ival);
context: get_hwc_spec(struct _buf *file, char *tokbuf, size_t linesize){	char *prop_name, *string, *class_string;	token_t token;	struct hwc_spec *hwcp;	struct dev_info *devi;	struct val_list *val_list;	hwc_state_t state;	u_longlong_t ival;	hwcp = kmem_zalloc(sizeof (*hwcp), KM_SLEEP);	devi = kmem_zalloc(sizeof (*devi), KM_SLEEP);	state = hwc_begin;	token = NAME;	prop_name = NULL;	val_list = NULL;	string = NULL;	do {#ifdef DEBUG		parse_debug(NULL, "state 0x%x\n", state);#endif		switch (token) {		case NAME:			switch (state) {			case prop:			case prop_equals_string:			case prop_equals_integer:				make_prop(file, (dev_info_t *)devi,				    prop_name, val_list);				prop_name = NULL;				val_list = NULL;				/*FALLTHROUGH*/			case hwc_begin:				if (strcmp(tokbuf, "PARENT") == 0 ||				    strcmp(tokbuf, "parent") == 0) {					state = parent;				} else if (strcmp(tokbuf, "NAME") == 0 ||				    strcmp(tokbuf, "name") == 0) {					state = drvname;				} else if (strcmp(tokbuf, "CLASS") == 0 ||				    strcmp(tokbuf, "class") == 0) {					state = drvclass;					prop_name = kmem_alloc(strlen(tokbuf) +						1, KM_SLEEP);					(void) strcpy(prop_name, tokbuf);				} else {					state = prop;					prop_name = kmem_alloc(strlen(tokbuf) +						1, KM_SLEEP);					(void) strcpy(prop_name, tokbuf);				}				break;			default:				kobj_file_err(CE_WARN, file, tok_err, tokbuf);			}			break;		case EQUALS:			switch (state) {			case drvname:				state = name_equals;				break;			case parent:				state = parent_equals;				break;			case drvclass:				state = drvclass_equals;				break;			case prop:				state = prop_equals;				break;			default:				kobj_file_err(CE_WARN, file, tok_err, tokbuf);			}			break;		case STRING:			string = kmem_alloc(strlen(tokbuf) + 1, KM_SLEEP);			(void) strcpy(string, tokbuf);			switch (state) {			case name_equals:				if (ddi_get_name((dev_info_t *)devi)) {					kobj_file_err(CE_WARN, file, "%s %s",						nm_err, omit_err);					goto bad;				}				devi->devi_name = string;				string = NULL;				state = hwc_begin;				break;			case parent_equals:				if (hwcp->hwc_parent_name) {					kobj_file_err(CE_WARN, file, "%s %s",						prnt_err, omit_err);					goto bad;				}				hwcp->hwc_parent_name = string;				string = NULL;				state = hwc_begin;				break;			case drvclass_equals:				if (hwcp->hwc_class_name) {					kobj_file_err(CE_WARN, file, class_err);					goto bad;				}				class_string = kmem_alloc(strlen(string) + 1,					KM_SLEEP);				(void) strcpy(class_string, string);				hwcp->hwc_class_name = class_string;				/*FALLTHROUGH*/			case prop_equals:			case prop_equals_string_comma:				add_val(&val_list, 0, string);				string = NULL;				state = prop_equals_string;				break;			default:				kobj_file_err(CE_WARN, file, tok_err, tokbuf);			}			break;		case HEXVAL:		case DECVAL:			switch (state) {			case prop_equals:			case prop_equals_integer_comma:				(void) kobj_getvalue(tokbuf, &ival);				add_val(&val_list, 1, (caddr_t)(uintptr_t)ival);				state = prop_equals_integer;				break;			default:				kobj_file_err(CE_WARN, file, tok_err, tokbuf);			}			break;		case COMMA:			switch (state) {			case prop_equals_string:				state = prop_equals_string_comma;				break;			case prop_equals_integer:				state = prop_equals_integer_comma;				break;			default:				kobj_file_err(CE_WARN, file, tok_err, tokbuf);			}			break;		case NEWLINE:			kobj_newline(file);			break;		case POUND:			kobj_find_eol(file);			break;		case EOF:			kobj_file_err(CE_WARN, file, "Unexpected EOF");			goto bad;		default:			kobj_file_err(CE_WARN, file, tok_err, tokbuf);			goto bad;		}	} while ((token = kobj_lex(file, tokbuf, linesize)) != SEMICOLON);	switch (state) {	case prop:	case prop_equals_string:	case prop_equals_integer:		make_prop(file, (dev_info_t *)devi,			prop_name, val_list);		break;	case hwc_begin:		break;	default:		kobj_file_err(CE_WARN, file, "Unexpected end of line");		break;	}	/* copy 2 relevant members of devi to hwcp */	hwcp->hwc_devi_sys_prop_ptr = devi->devi_sys_prop_ptr;	hwcp->hwc_devi_name = devi->devi_name;	kmem_free(devi, sizeof (struct dev_info));	return (hwcp);bad:	if (string) {		kmem_free(string, strlen(string) + 1);	}	if (hwcp) {		hwc_free(hwcp);	}	if (devi) {		if (devi->devi_name)			kmem_free(devi->devi_name,			    strlen(devi->devi_name) + 1);		kmem_free(devi, sizeof (struct dev_info));	}	return (NULL);}