Skip to content

Commit

Permalink
[MTD] Fix error checking after get_mtd_device() in get_sb_mtd functions
Browse files Browse the repository at this point in the history
It returns ERR_PTR(foo) on error, not just NULL.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
David Woodhouse committed Jun 1, 2007
1 parent ea55d30 commit 718ea83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/mtd/mtdsuper.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ static int get_sb_mtd_nr(struct file_system_type *fs_type, int flags,
struct mtd_info *mtd;

mtd = get_mtd_device(NULL, mtdnr);
if (!mtd) {
if (IS_ERR(mtd)) {
DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr);
return -EINVAL;
return PTR_ERR(mtd);
}

return get_sb_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super,
Expand Down Expand Up @@ -145,7 +145,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,

for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
mtd = get_mtd_device(NULL, mtdnr);
if (mtd) {
if (!IS_ERR(mtd)) {
if (!strcmp(mtd->name, dev_name + 4))
return get_sb_mtd_aux(
fs_type, flags,
Expand Down

0 comments on commit 718ea83

Please sign in to comment.