aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/au1550nd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/au1550nd.c')
-rw-r--r--drivers/mtd/nand/au1550nd.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
index 43d46e424040..3ffe05db4923 100644
--- a/drivers/mtd/nand/au1550nd.c
+++ b/drivers/mtd/nand/au1550nd.c
@@ -451,7 +451,7 @@ static int __init au1xxx_nand_init(void)
451 u32 nand_phys; 451 u32 nand_phys;
452 452
453 /* Allocate memory for MTD device structure and private data */ 453 /* Allocate memory for MTD device structure and private data */
454 au1550_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL); 454 au1550_mtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
455 if (!au1550_mtd) { 455 if (!au1550_mtd) {
456 printk("Unable to allocate NAND MTD dev structure.\n"); 456 printk("Unable to allocate NAND MTD dev structure.\n");
457 return -ENOMEM; 457 return -ENOMEM;
@@ -460,10 +460,6 @@ static int __init au1xxx_nand_init(void)
460 /* Get pointer to private data */ 460 /* Get pointer to private data */
461 this = (struct nand_chip *)(&au1550_mtd[1]); 461 this = (struct nand_chip *)(&au1550_mtd[1]);
462 462
463 /* Initialize structures */
464 memset(au1550_mtd, 0, sizeof(struct mtd_info));
465 memset(this, 0, sizeof(struct nand_chip));
466
467 /* Link the private data with the MTD structure */ 463 /* Link the private data with the MTD structure */
468 au1550_mtd->priv = this; 464 au1550_mtd->priv = this;
469 au1550_mtd->owner = THIS_MODULE; 465 au1550_mtd->owner = THIS_MODULE;
@@ -544,7 +540,7 @@ static int __init au1xxx_nand_init(void)
544 } 540 }
545 nand_phys = (mem_staddr << 4) & 0xFFFC0000; 541 nand_phys = (mem_staddr << 4) & 0xFFFC0000;
546 542
547 p_nand = (void __iomem *)ioremap(nand_phys, 0x1000); 543 p_nand = ioremap(nand_phys, 0x1000);
548 544
549 /* make controller and MTD agree */ 545 /* make controller and MTD agree */
550 if (NAND_CS == 0) 546 if (NAND_CS == 0)
@@ -589,7 +585,7 @@ static int __init au1xxx_nand_init(void)
589 return 0; 585 return 0;
590 586
591 outio: 587 outio:
592 iounmap((void *)p_nand); 588 iounmap(p_nand);
593 589
594 outmem: 590 outmem:
595 kfree(au1550_mtd); 591 kfree(au1550_mtd);
@@ -610,7 +606,7 @@ static void __exit au1550_cleanup(void)
610 kfree(au1550_mtd); 606 kfree(au1550_mtd);
611 607
612 /* Unmap */ 608 /* Unmap */
613 iounmap((void *)p_nand); 609 iounmap(p_nand);
614} 610}
615 611
616module_exit(au1550_cleanup); 612module_exit(au1550_cleanup);