plat_ram: call mtd_device_register only if partition data exists
PATCH 1/1 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.
--- drivers/mtd/maps/plat-ram.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
drivers/mtd/maps/plat-ram.c +8 -4
@@ -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;
Signature · 1 line
1.7.6.4
Quoted 5 lines · Ilya Yanok
mtd_device_parse_register()registers the device as a whole if no partition data is passed so there is no reason to callmtd_device_register()after that.Signed-off-by Ilya Yanok <[email protected]>
This seems to be a bug-fix, right? What happens without this patch? We end up with 2 MTD equivalent MTD devices?
Signature · 2 lines
Best Regards, Artem Bityutskiy
Hi Artem,
Quoted 7 lines · Artem Bityutskiy
Quoted 5 lines
mtd_device_parse_register()registers the device as a whole if no partition data is passed so there is no reason to callmtd_device_register()after that.Signed-off-by Ilya Yanok <[email protected]>This seems to be a bug-fix, right? What happens without this patch?
Right.
Quoted 1 line
We end up with 2 MTD equivalent MTD devices?
Yes (only second one shown in /proc/mtd) and a warning for kobject:
kobject (cf2c10e0): tried to init an initialized object, something is seriously wrong.
Regards, Ilya.
Quoted 11 lines · Ilya Yanok
Hi Artem,
Quoted 7 lines · Artem Bityutskiy
Quoted 5 lines
mtd_device_parse_register()registers the device as a whole if no partition data is passed so there is no reason to callmtd_device_register()after that.Signed-off-by Ilya Yanok <[email protected]>This seems to be a bug-fix, right? What happens without this patch?
Quoted 8 lines
Right.
Quoted 1 line
We end up with 2 MTD equivalent MTD devices?
Yes (only second one shown in
/proc/mtd) and a warning for kobject:kobject (
cf2c10e0): tried to init an initialized object, something is seriously wrong.
OK, then I'll ping David Woodhouse to merge this before 3.2 release. Taken to l2-mtd-2.6.git so far, thanks!
Signature · 2 lines
Best Regards, Artem Bityutskiy