lkml.org 
[lkml]   [2005]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 1/9] UML - Error path cleanup
Date
From
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>

Index: linux-2.6.13-rc6-mm1/arch/um/drivers/ubd_kern.c
===================================================================
--- linux-2.6.13-rc6-mm1.orig/arch/um/drivers/ubd_kern.c 2005-08-29 11:51:22.000000000 -0400
+++ linux-2.6.13-rc6-mm1/arch/um/drivers/ubd_kern.c 2005-08-29 11:57:44.000000000 -0400
@@ -668,21 +668,22 @@
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 @@
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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-29 22:32    [W:0.225 / U:0.312 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site