Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207778
b: refs/heads/master
c: 9d2c4f3
h: refs/heads/master
v: v3
  • Loading branch information
Anton Vorontsov authored and David Woodhouse committed Aug 4, 2010
1 parent 1e40e18 commit 6cbd2c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 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: f7b000904a848b64c36e3b4d0715744aaf345767
refs/heads/master: 9d2c4f3fe50a6d07275de91b392aaaf4773bc8b6
18 changes: 6 additions & 12 deletions trunk/drivers/mtd/devices/m25p80.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/

#include <linux/init.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/interrupt.h>
Expand Down Expand Up @@ -734,22 +736,14 @@ static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi)
if (tmp < 0) {
DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n",
dev_name(&spi->dev), tmp);
return NULL;
return ERR_PTR(tmp);
}
jedec = id[0];
jedec = jedec << 8;
jedec |= id[1];
jedec = jedec << 8;
jedec |= id[2];

/*
* Some chips (like Numonyx M25P80) have JEDEC and non-JEDEC variants,
* which depend on technology process. Officially RDID command doesn't
* exist for non-JEDEC chips, but for compatibility they return ID 0.
*/
if (jedec == 0)
return NULL;

ext_jedec = id[3] << 8 | id[4];

for (tmp = 0; tmp < ARRAY_SIZE(m25p_ids) - 1; tmp++) {
Expand All @@ -760,7 +754,7 @@ static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi)
return &m25p_ids[tmp];
}
}
return NULL;
return ERR_PTR(-ENODEV);
}


Expand Down Expand Up @@ -805,8 +799,8 @@ static int __devinit m25p_probe(struct spi_device *spi)
const struct spi_device_id *jid;

jid = jedec_probe(spi);
if (!jid) {
return -ENODEV;
if (IS_ERR(jid)) {
return PTR_ERR(jid);
} else if (jid != id) {
/*
* JEDEC knows better, so overwrite platform ID. We
Expand Down

0 comments on commit 6cbd2c6

Please sign in to comment.