static int __init omap_onenand_init (void) 
static int __init omap_onenand_init(void) 
static int __init omap_onenand_init (void){	struct onenand_chip *this;	struct mtd_partition *dynamic_partition = 0;	int err = 0;	/* Allocate memory for MTD device structure and private data */	omap_onenand_mtd = kmalloc (sizeof(struct mtd_info) + sizeof (struct onenand_chip),				GFP_KERNEL);	if (!omap_onenand_mtd) {		printk (KERN_WARNING "Unable to allocate OneNAND MTD device structure.\n");		err = -ENOMEM;		goto out;	}	/* Get pointer to private data */	this = (struct onenand_chip *) (&omap_onenand_mtd[1]);	/* Initialize structures */	memset((char *) omap_onenand_mtd, 0, sizeof(struct mtd_info) + sizeof(struct onenand_chip));	/* Link the private data with the MTD structure */	omap_onenand_mtd->priv = this;	this->mmcontrol = omap_onenand_mmcontrol;        /* try the first address */	this->base = ioremap(OMAP_ONENAND_FLASH_START1, SZ_128K);	omap_find_emifs_cs(OMAP_ONENAND_FLASH_START1);	omap_onenand_mtd->name = onenand_name;	if (onenand_scan(omap_onenand_mtd, 1)){		/* try the second address */		iounmap(this->base);		this->base = ioremap(OMAP_ONENAND_FLASH_START2, SZ_128K);		omap_find_emifs_cs(OMAP_ONENAND_FLASH_START2);		if (onenand_scan(omap_onenand_mtd, 1)) {			iounmap(this->base);                        err = -ENXIO;                        goto out_mtd;		}	}	/* Register the partitions */	switch (omap_onenand_mtd->size) {	case SZ_128M:	case SZ_64M:	case SZ_32M:#ifdef CONFIG_MTD_PARTITIONS		err = parse_mtd_partitions(omap_onenand_mtd, part_probes,					&dynamic_partition, 0);		if (err > 0)			err = add_mtd_partitions(omap_onenand_mtd,					dynamic_partition, err);		else if (1)			err = add_mtd_partitions(omap_onenand_mtd,					static_partition,					ARRAY_SIZE(static_partition));		else#endif			err = add_mtd_device(omap_onenand_mtd);		if (err)			goto out_buf;		break;	default:		printk(KERN_WARNING "Unsupported OneNAND device\n");		err = -ENXIO;		goto out_buf;	}	return 0;out_buf:	onenand_release(omap_onenand_mtd);	iounmap(this->base);out_mtd:	kfree(omap_onenand_mtd);out:	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/fcc31470c49e224ed8115c70541f599fc7568fee/omap-onenand.c/buggy/drivers/mtd/onenand/omap-onenand.c