Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176919
b: refs/heads/master
c: d470266
h: refs/heads/master
i:
  176917: 58af254
  176915: 7711b0e
  176911: 6f87015
v: v3
  • Loading branch information
H Hartley Sweeten authored and David Woodhouse committed Oct 17, 2009
1 parent 1bcaf59 commit 755cdfe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f54d6336372b97d3624d1c5c179b2dd062472bd1
refs/heads/master: d4702669b0b64b8fa7c91123639ec20d9592ee43
19 changes: 16 additions & 3 deletions trunk/drivers/mtd/devices/mtd_dataflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ add_dataflash_otp(struct spi_device *spi, char *name,
struct mtd_info *device;
struct flash_platform_data *pdata = spi->dev.platform_data;
char *otp_tag = "";
int err = 0;

priv = kzalloc(sizeof *priv, GFP_KERNEL);
if (!priv)
Expand Down Expand Up @@ -693,13 +694,23 @@ add_dataflash_otp(struct spi_device *spi, char *name,

if (nr_parts > 0) {
priv->partitioned = 1;
return add_mtd_partitions(device, parts, nr_parts);
err = add_mtd_partitions(device, parts, nr_parts);
goto out;
}
} else if (pdata && pdata->nr_parts)
dev_warn(&spi->dev, "ignoring %d default partitions on %s\n",
pdata->nr_parts, device->name);

return add_mtd_device(device) == 1 ? -ENODEV : 0;
if (add_mtd_device(device) == 1)
err = -ENODEV;

out:
if (!err)
return 0;

dev_set_drvdata(&spi->dev, NULL);
kfree(priv);
return err;
}

static inline int __devinit
Expand Down Expand Up @@ -932,8 +943,10 @@ static int __devexit dataflash_remove(struct spi_device *spi)
status = del_mtd_partitions(&flash->mtd);
else
status = del_mtd_device(&flash->mtd);
if (status == 0)
if (status == 0) {
dev_set_drvdata(&spi->dev, NULL);
kfree(flash);
}
return status;
}

Expand Down

0 comments on commit 755cdfe

Please sign in to comment.