diff options
-rw-r--r-- | drivers/mtd/devices/block2mtd.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index 457774eef4d0..218eb2af564a 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c @@ -215,7 +215,11 @@ static void block2mtd_free_device(struct block2mtd_dev *dev) kfree(dev); } -static struct block_device *mdtblock_early_get_bdev(const char *devname, +/* + * This function is marked __ref because it calls the __init marked + * early_lookup_bdev when called from the early boot code. + */ +static struct block_device __ref *mdtblock_early_get_bdev(const char *devname, fmode_t mode, int timeout, struct block2mtd_dev *dev) { struct block_device *bdev = ERR_PTR(-ENODEV); @@ -223,6 +227,12 @@ static struct block_device *mdtblock_early_get_bdev(const char *devname, int i; /* + * We can't use early_lookup_bdev from a running system. + */ + if (system_state >= SYSTEM_RUNNING) + return bdev; + + /* * We might not have the root device mounted at this point. * Try to resolve the device name by other means. */ |