static int bcm47xxsflash_probe(struct platform_device *pdev) { struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev); int err; sflash->mtd = kzalloc(sizeof(struct mtd_info), GFP_KERNEL); if (!sflash->mtd) { err = -ENOMEM; goto out; } bcm47xxsflash_fill_mtd(sflash, sflash->mtd); err = mtd_device_parse_register(sflash->mtd, probes, NULL, NULL, 0); if (err) { pr_err("Failed to register MTD device: %d\n", err); goto err_dev_reg; } return 0; err_dev_reg: kfree(sflash->mtd); out: return err; }
static int bcm47xxsflash_probe(struct platform_device *pdev) { struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev); struct bcm47xxsflash *b47s; int err; b47s = kzalloc(sizeof(*b47s), GFP_KERNEL); if (!b47s) { err = -ENOMEM; goto out; } sflash->priv = b47s; b47s->window = sflash->window; b47s->blocksize = sflash->blocksize; b47s->numblocks = sflash->numblocks; b47s->size = sflash->size; bcm47xxsflash_fill_mtd(b47s); err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0); if (err) { pr_err("Failed to register MTD device: %d\n", err); goto err_dev_reg; } return 0; err_dev_reg: kfree(&b47s->mtd); out: return err; }