public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH -mm] UBI: one less BUG usage
@ 2007-06-26 22:30 Randy Dunlap
  2007-06-27 21:47 ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2007-06-26 22:30 UTC (permalink / raw)
  To: linux-mtd; +Cc: akpm

From: Randy Dunlap <randy.dunlap@oracle.com>

Eliminate one BUG() usage.  The callers of major_to_device() already
handle and report errors.  This is just another error to return.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 drivers/mtd/ubi/cdev.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- linux-2622-rc4mm2.orig/drivers/mtd/ubi/cdev.c
+++ linux-2622-rc4mm2/drivers/mtd/ubi/cdev.c
@@ -63,7 +63,7 @@ static struct ubi_device *major_to_devic
 	for (i = 0; i < ubi_devices_cnt; i++)
 		if (ubi_devices[i] && ubi_devices[i]->major == major)
 			return ubi_devices[i];
-	BUG();
+	return ERR_PTR(-ENODEV);
 }
 
 /**
@@ -127,6 +127,9 @@ static int vol_cdev_open(struct inode *i
 	int vol_id = iminor(inode) - 1;
 	int mode;
 
+	if (IS_ERR(ubi))
+		return PTR_ERR(ubi);
+
 	if (file->f_mode & FMODE_WRITE)
 		mode = UBI_READWRITE;
 	else

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-28 16:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-26 22:30 [PATCH -mm] UBI: one less BUG usage Randy Dunlap
2007-06-27 21:47 ` Artem Bityutskiy
2007-06-28  5:13   ` Randy Dunlap
2007-06-28 16:36     ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox