summaryrefslogtreecommitdiff
path: root/sys/dev/dm/dm_ioctl.c
diff options
context:
space:
mode:
authorhaad <haad@NetBSD.org>2009-04-13 18:51:54 +0000
committerhaad <haad@NetBSD.org>2009-04-13 18:51:54 +0000
commit33e2a4a9188dc77002044c665df95690dc7197e7 (patch)
tree727298b7b422d1354b7cb79c324597c63272832b /sys/dev/dm/dm_ioctl.c
parent94d1f41faa7c153af50158e89c6a0c70578bac3a (diff)
Destroy locks in dm_dev_free, do not allocate struct disk twice.
Diffstat (limited to 'sys/dev/dm/dm_ioctl.c')
-rw-r--r--sys/dev/dm/dm_ioctl.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/sys/dev/dm/dm_ioctl.c b/sys/dev/dm/dm_ioctl.c
index 0f3feada2c5..9dc84fe6fc3 100644
--- a/sys/dev/dm/dm_ioctl.c
+++ b/sys/dev/dm/dm_ioctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.10 2009/04/06 22:58:10 haad Exp $ */
+/* $NetBSD: dm_ioctl.c,v 1.11 2009/04/13 18:51:54 haad Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -219,10 +219,7 @@ dm_dev_create_ioctl(prop_dictionary_t dm_dict)
if ((dmv = dm_dev_alloc()) == NULL)
return ENOMEM;
-
- if ((dmv->diskp = kmem_alloc(sizeof(struct disk), KM_NOSLEEP)) == NULL)
- return ENOMEM;
-
+
if (uuid)
strncpy(dmv->uuid, uuid, DM_UUID_LEN);
else
@@ -251,11 +248,8 @@ dm_dev_create_ioctl(prop_dictionary_t dm_dict)
disk_init(dmv->diskp, dmv->name, &dmdkdriver);
disk_attach(dmv->diskp);
- if ((r = dm_dev_insert(dmv)) != 0){
- mutex_destroy(&dmv->dev_mtx);
- cv_destroy(&dmv->dev_cv);
+ if ((r = dm_dev_insert(dmv)) != 0)
dm_dev_free(dmv);
- }
DM_ADD_FLAG(flags, DM_EXISTS_FLAG);
DM_REMOVE_FLAG(flags, DM_INACTIVE_PRESENT_FLAG);
@@ -400,9 +394,6 @@ dm_dev_remove_ioctl(prop_dictionary_t dm_dict)
dm_table_head_destroy(&dmv->table_head);
- mutex_destroy(&dmv->dev_mtx);
- cv_destroy(&dmv->dev_cv);
-
/* Destroy disk device structure */
disk_detach(dmv->diskp);
disk_destroy(dmv->diskp);