} else { err = add_mtd_device(info->mtd); 
static int bast_flash_probe(struct device *dev){	struct platform_device *pdev = to_platform_device(dev);	struct bast_flash_info *info;	struct resource *res;	int err = 0;	info = kmalloc(sizeof(*info), GFP_KERNEL);	if (info == NULL) {		printk(KERN_ERR PFX "no memory for flash info\n");		err = -ENOMEM;		goto exit_error;	}	memzero(info, sizeof(*info));	dev_set_drvdata(dev, info);	res = pdev->resource;  /* assume that the flash has one resource */	info->map.phys = res->start;	info->map.size = res->end - res->start + 1;	info->map.name = dev->bus_id;		info->map.bankwidth = 2;		if (info->map.size > AREA_MAXSIZE)		info->map.size = AREA_MAXSIZE;	pr_debug("%s: area %08lx, size %ld\n", __FUNCTION__,		 info->map.phys, info->map.size);		info->area = request_mem_region(res->start, info->map.size,					pdev->name);	if (info->area == NULL) {		printk(KERN_ERR PFX "cannot reserve flash memory region\n");		err = -ENOENT;		goto exit_error;	}	info->map.virt = ioremap(res->start, info->map.size);	pr_debug("%s: virt at %08x\n", __FUNCTION__, (int)info->map.virt);	if (info->map.virt == 0) {		printk(KERN_ERR PFX "failed to ioremap() region\n");		err = -EIO;		goto exit_error;	} 	simple_map_init(&info->map);	/* enable the write to the flash area */	bast_flash_setrw(1);	/* probe for the device(s) */	info->mtd = do_map_probe("jedec_probe", &info->map);	if (info->mtd == NULL)		info->mtd = do_map_probe("cfi_probe", &info->map);	if (info->mtd == NULL) {		printk(KERN_ERR PFX "map_probe() failed\n");		err = -ENXIO;		goto exit_error;	}	/* mark ourselves as the owner */	info->mtd->owner = THIS_MODULE;	err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0);	if (err > 0) {		err = add_mtd_partitions(info->mtd, info->partitions, err);		if (err) 			printk(KERN_ERR PFX "cannot add/parse partitions\n");	}	if (err == 0)		return 0;	/* fall through to exit error */ exit_error:	bast_flash_remove(dev);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/6fc93d8ca7a093feb403aca4ee3cb5bda338392c/bast-flash.c/buggy/drivers/mtd/maps/bast-flash.c