mtd: plat_ram: call mtd_device_register only if partition data exists
mtd_device_parse_register() registers the device as a whole if no partition data is passed so there is no reason to call mtd_device_register() after that. Signed-off-by: Ilya Yanok <yanok@emcraft.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
7148b79992
commit
c32987918e
|
@ -227,10 +227,14 @@ static int platram_probe(struct platform_device *pdev)
|
|||
if (!err)
|
||||
dev_info(&pdev->dev, "registered mtd device\n");
|
||||
|
||||
if (pdata->nr_partitions) {
|
||||
/* add the whole device. */
|
||||
err = mtd_device_register(info->mtd, NULL, 0);
|
||||
if (err)
|
||||
dev_err(&pdev->dev, "failed to register the entire device\n");
|
||||
if (err) {
|
||||
dev_err(&pdev->dev,
|
||||
"failed to register the entire device\n");
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
|
|
Loading…
Reference in New Issue