From ecb598d0b2ca4897a3962aed7680ee3d28dda6e8 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 8 Oct 2013 15:31:45 +0530 Subject: mtd: socrates_nand: Remove redundant dev_set_drvdata Driver core will set the driver data to NULL upon detach or probe failure. Signed-off-by: Sachin Kamat Signed-off-by: Brian Norris --- drivers/mtd/nand/socrates_nand.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/mtd/nand/socrates_nand.c') diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c index 09dde7d27178..f44c7c884a20 100644 --- a/drivers/mtd/nand/socrates_nand.c +++ b/drivers/mtd/nand/socrates_nand.c @@ -211,7 +211,6 @@ static int socrates_nand_probe(struct platform_device *ofdev) nand_release(mtd); out: - dev_set_drvdata(&ofdev->dev, NULL); iounmap(host->io_base); kfree(host); return res; @@ -227,7 +226,6 @@ static int socrates_nand_remove(struct platform_device *ofdev) nand_release(mtd); - dev_set_drvdata(&ofdev->dev, NULL); iounmap(host->io_base); kfree(host); -- cgit v1.2.3 From cf3a9b56a128ec8a1631c29aacb8cf19b55ea73d Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 8 Oct 2013 15:31:46 +0530 Subject: mtd: socrates_nand: Use devm_kzalloc devm_kzalloc is device managed and makes code simpler. Signed-off-by: Sachin Kamat Signed-off-by: Brian Norris --- drivers/mtd/nand/socrates_nand.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'drivers/mtd/nand/socrates_nand.c') diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c index f44c7c884a20..e77da7efa200 100644 --- a/drivers/mtd/nand/socrates_nand.c +++ b/drivers/mtd/nand/socrates_nand.c @@ -149,17 +149,13 @@ static int socrates_nand_probe(struct platform_device *ofdev) struct mtd_part_parser_data ppdata; /* Allocate memory for the device structure (and zero it) */ - host = kzalloc(sizeof(struct socrates_nand_host), GFP_KERNEL); - if (!host) { - printk(KERN_ERR - "socrates_nand: failed to allocate device structure.\n"); + host = devm_kzalloc(&ofdev->dev, sizeof(*host), GFP_KERNEL); + if (!host) return -ENOMEM; - } host->io_base = of_iomap(ofdev->dev.of_node, 0); if (host->io_base == NULL) { printk(KERN_ERR "socrates_nand: ioremap failed\n"); - kfree(host); return -EIO; } @@ -212,7 +208,6 @@ static int socrates_nand_probe(struct platform_device *ofdev) out: iounmap(host->io_base); - kfree(host); return res; } @@ -227,7 +222,6 @@ static int socrates_nand_remove(struct platform_device *ofdev) nand_release(mtd); iounmap(host->io_base); - kfree(host); return 0; } -- cgit v1.2.3 From 5422933d58c28ebc67c7425f20e85ef27b730188 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 8 Oct 2013 15:38:08 +0530 Subject: mtd: socrates_nand: Use dev_err instead of printk dev_err is preferred to printk. Signed-off-by: Sachin Kamat Signed-off-by: Brian Norris --- drivers/mtd/nand/socrates_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/mtd/nand/socrates_nand.c') diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c index e77da7efa200..9a9fa4949b4f 100644 --- a/drivers/mtd/nand/socrates_nand.c +++ b/drivers/mtd/nand/socrates_nand.c @@ -155,7 +155,7 @@ static int socrates_nand_probe(struct platform_device *ofdev) host->io_base = of_iomap(ofdev->dev.of_node, 0); if (host->io_base == NULL) { - printk(KERN_ERR "socrates_nand: ioremap failed\n"); + dev_err(&ofdev->dev, "ioremap failed\n"); return -EIO; } -- cgit v1.2.3