public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: linux-mtd@lists.infradead.org
Cc: akpm <akpm@linux-foundation.org>
Subject: [PATCH -mm] UBI: one less BUG usage
Date: Tue, 26 Jun 2007 15:30:27 -0700	[thread overview]
Message-ID: <20070626153027.cbe757f0.randy.dunlap@oracle.com> (raw)

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

             reply	other threads:[~2007-06-26 22:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-26 22:30 Randy Dunlap [this message]
2007-06-27 21:47 ` [PATCH -mm] UBI: one less BUG usage Artem Bityutskiy
2007-06-28  5:13   ` Randy Dunlap
2007-06-28 16:36     ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070626153027.cbe757f0.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox