diff options
Diffstat (limited to 'arch/um/drivers/ubd_kern.c')
-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) | |||
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; | ||
698 | out_close: | ||
696 | ubd_close(dev); | 699 | ubd_close(dev); |
697 | return 0; | 700 | out: |
701 | return err; | ||
698 | } | 702 | } |
699 | 703 | ||
700 | static int ubd_config(char *str) | 704 | static int ubd_config(char *str) |