From patchwork Mon Dec 31 08:57:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: mtd: fix uninitialised mtd map name Date: Sun, 30 Dec 2012 22:57:30 -0000 From: Guennadi Liakhovetski X-Patchwork-Id: 208821 Message-Id: To: linux-mtd@lists.infradead.org Cc: Artem Bityutskiy , Jean-Christophe PLAGNIOL-VILLARD , David Woodhouse A recent commit "mtd: physmap_of: allow to specify the mtd name for retro compatiblity" introduced a regression: if no linux,mtd-name DT property is provided, the local mtd_name variable remains uninitialised and usually it's != NULL, which leads to a random garbage in MTD map name. Fix this by initialising the variable to NULL. Signed-off-by: Guennadi Liakhovetski --- Please, push to 3.8, unless already fixed. drivers/mtd/maps/physmap_of.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 37cdc20..6fb2bd8 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -170,7 +170,7 @@ static int of_flash_probe(struct platform_device *dev) resource_size_t res_size; struct mtd_part_parser_data ppdata; bool map_indirect; - const char *mtd_name; + const char *mtd_name = NULL; match = of_match_device(of_flash_match, &dev->dev); if (!match)