summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorhaad <haad@NetBSD.org>2010-01-03 22:55:25 +0000
committerhaad <haad@NetBSD.org>2010-01-03 22:55:25 +0000
commit66ff9118086b0965cd2260d2be5869309bef4d03 (patch)
tree97a8f03cac551c65549e0fcfda1c71aa60658ac6 /sys/dev
parentc52cab8857c5c84a248be4f1f499a658f318fd53 (diff)
Refactor dmioctl to by cleaner and to copyout dictionary in case when something
went wrong.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/dm/device-mapper.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/dev/dm/device-mapper.c b/sys/dev/dm/device-mapper.c
index 158e0d9b172..17616df9285 100644
--- a/sys/dev/dm/device-mapper.c
+++ b/sys/dev/dm/device-mapper.c
@@ -1,4 +1,4 @@
-/* $NetBSD: device-mapper.c,v 1.13 2010/01/03 22:44:10 haad Exp $ */
+/* $NetBSD: device-mapper.c,v 1.14 2010/01/03 22:55:25 haad Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -336,19 +336,15 @@ dmioctl(dev_t dev, const u_long cmd, void *data, int flag, struct lwp *l)
if((r = prop_dictionary_copyin_ioctl(pref, cmd, &dm_dict_in)) != 0)
return r;
- if ((r = dm_check_version(dm_dict_in)) != 0) {
- prop_object_release(dm_dict_in);
- return r;
- }
+ if ((r = dm_check_version(dm_dict_in)) != 0)
+ goto cleanup_exit;
/* run ioctl routine */
- if ((r = dm_cmd_to_fun(dm_dict_in)) != 0) {
- prop_object_release(dm_dict_in);
- return r;
- }
+ if ((r = dm_cmd_to_fun(dm_dict_in)) != 0)
+ goto cleanup_exit;
+cleanup_exit:
r = prop_dictionary_copyout_ioctl(pref, cmd, dm_dict_in);
-
prop_object_release(dm_dict_in);
}