aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2005-09-03 18:57:29 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:06:21 -0400
commitec7cf783dd6cf5c8fb6b6767560686ed28d1cd6d (patch)
tree80cd4175dade9146e0353771e69080deda037374
parent7efd08c85523f9468a6a8748d6f02b3e73967569 (diff)
[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>
-rw-r--r--arch/um/drivers/ubd_kern.c14
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)
668 struct ubd *dev = &ubd_dev[n]; 668 struct ubd *dev = &ubd_dev[n];
669 int err; 669 int err;
670 670
671 err = -ENODEV;
671 if(dev->file == NULL) 672 if(dev->file == NULL)
672 return(-ENODEV); 673 goto out;
673 674
674 if (ubd_open_dev(dev)) 675 if (ubd_open_dev(dev))
675 return(-ENODEV); 676 goto out;
676 677
677 err = ubd_file_size(dev, &dev->size); 678 err = ubd_file_size(dev, &dev->size);
678 if(err < 0) 679 if(err < 0)
679 return(err); 680 goto out_close;
680 681
681 dev->size = ROUND_BLOCK(dev->size); 682 dev->size = ROUND_BLOCK(dev->size);
682 683
683 err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]); 684 err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]);
684 if(err) 685 if(err)
685 return(err); 686 goto out_close;
686 687
687 if(fake_major != MAJOR_NR) 688 if(fake_major != MAJOR_NR)
688 ubd_new_disk(fake_major, dev->size, n, 689 ubd_new_disk(fake_major, dev->size, n,
@@ -693,8 +694,11 @@ static int ubd_add(int n)
693 if (fake_ide) 694 if (fake_ide)
694 make_ide_entries(ubd_gendisk[n]->disk_name); 695 make_ide_entries(ubd_gendisk[n]->disk_name);
695 696
697 err = 0;
698out_close:
696 ubd_close(dev); 699 ubd_close(dev);
697 return 0; 700out:
701 return err;
698} 702}
699 703
700static int ubd_config(char *str) 704static int ubd_config(char *str)