summaryrefslogtreecommitdiff
path: root/nuttx/drivers/mtd
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-01 15:32:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-01 15:32:39 +0000
commit7dba70eeaf6654f9837902db9ac290fd5b4cfed4 (patch)
tree2e02176b8ca78da4db5ac2181c8bdb95ab8cd2d2 /nuttx/drivers/mtd
parent43c642c61857ceefe07ce0fb929c569b52a545a5 (diff)
downloadpx4-nuttx-7dba70eeaf6654f9837902db9ac290fd5b4cfed4.tar.gz
px4-nuttx-7dba70eeaf6654f9837902db9ac290fd5b4cfed4.tar.bz2
px4-nuttx-7dba70eeaf6654f9837902db9ac290fd5b4cfed4.zip
Additional patches from Petteri Aimonen for FAT, STM32 SPI, and AT25
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5593 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/mtd')
-rw-r--r--nuttx/drivers/mtd/at25.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/nuttx/drivers/mtd/at25.c b/nuttx/drivers/mtd/at25.c
index e35b794a5..c58b16122 100644
--- a/nuttx/drivers/mtd/at25.c
+++ b/nuttx/drivers/mtd/at25.c
@@ -691,14 +691,16 @@ FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev)
kfree(priv);
priv = NULL;
}
-
- /* Unprotect all sectors */
+ else
+ {
+ /* Unprotect all sectors */
- at25_writeenable(priv);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
- (void)SPI_SEND(priv->dev, AT25_WRSR);
- (void)SPI_SEND(priv->dev, AT25_SR_UNPROT);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ at25_writeenable(priv);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ (void)SPI_SEND(priv->dev, AT25_WRSR);
+ (void)SPI_SEND(priv->dev, AT25_SR_UNPROT);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ }
}
/* Return the implementation-specific state structure as the MTD device */