diff options
author | Jeff Dike <jdike@addtoit.com> | 2005-09-03 15:57:29 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 00:06:21 -0700 |
commit | ec7cf783dd6cf5c8fb6b6767560686ed28d1cd6d (patch) | |
tree | 80cd4175dade9146e0353771e69080deda037374 /arch/um/drivers | |
parent | 7efd08c85523f9468a6a8748d6f02b3e73967569 (diff) | |
download | blackbird-op-linux-ec7cf783dd6cf5c8fb6b6767560686ed28d1cd6d.tar.gz blackbird-op-linux-ec7cf783dd6cf5c8fb6b6767560686ed28d1cd6d.zip |
[PATCH] uml: error path cleanup
This cleans up the error path in ubd_open, causing it now to call ubd_close
appropriately when something fails.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 344b24d09a7c..f73134333f64 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -668,21 +668,22 @@ static int ubd_add(int n) struct ubd *dev = &ubd_dev[n]; int err; + err = -ENODEV; if(dev->file == NULL) - return(-ENODEV); + goto out; if (ubd_open_dev(dev)) - return(-ENODEV); + goto out; err = ubd_file_size(dev, &dev->size); if(err < 0) - return(err); + goto out_close; dev->size = ROUND_BLOCK(dev->size); err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]); if(err) - return(err); + goto out_close; if(fake_major != MAJOR_NR) ubd_new_disk(fake_major, dev->size, n, @@ -693,8 +694,11 @@ static int ubd_add(int n) if (fake_ide) make_ide_entries(ubd_gendisk[n]->disk_name); + err = 0; +out_close: ubd_close(dev); - return 0; +out: + return err; } static int ubd_config(char *str) |