Skip to content

Commit

Permalink
[PATCH] uml: error path cleanup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed Sep 5, 2005
1 parent 7efd08c commit ec7cf78
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit ec7cf78

Please sign in to comment.