Skip to content

Commit

Permalink
mtd: plat_ram: call mtd_device_register only if partition data exists
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ilya Yanok authored and David Woodhouse committed Dec 19, 2011
1 parent 7148b79 commit c329879
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/mtd/maps/plat-ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,14 @@ static int platram_probe(struct platform_device *pdev)
if (!err)
dev_info(&pdev->dev, "registered mtd device\n");

/* 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 (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");
}
}

return err;

Expand Down

0 comments on commit c329879

Please sign in to comment.