logfs: handle errors from get_mtd_device()

The get_mtd_device() function returns error pointers on failure and if we
don't handle it, it leads to a crash.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Joern Engel <joern@logfs.org>
This commit is contained in:
Dan Carpenter 2010-05-07 10:59:06 +02:00 committed by Joern Engel
parent 58e323cf5e
commit ccf31c10f1
1 changed files with 2 additions and 0 deletions

View File

@ -250,5 +250,7 @@ int logfs_get_sb_mtd(struct file_system_type *type, int flags,
const struct logfs_device_ops *devops = &mtd_devops;
mtd = get_mtd_device(NULL, mtdnr);
if (IS_ERR(mtd))
return PTR_ERR(mtd);
return logfs_get_sb_device(type, flags, mtd, NULL, devops, mnt);
}