summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-03-05 08:08:11 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-03-05 08:08:11 -0600
commitdbca8f5549a676ec663f67d2bba9776f83b8fbf3 (patch)
tree4fa4fbe98f083568016afee3f8b9b1ae3a659ed2 /nuttx
parentc22fe5519089b2897bbf13b576e17127b4ea764b (diff)
downloadpx4-nuttx-dbca8f5549a676ec663f67d2bba9776f83b8fbf3.tar.gz
px4-nuttx-dbca8f5549a676ec663f67d2bba9776f83b8fbf3.tar.bz2
px4-nuttx-dbca8f5549a676ec663f67d2bba9776f83b8fbf3.zip
Fix some BBRAM return values (from David Sidrane). Also some MTD-related cosmetic changes
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_bbsram.c14
-rw-r--r--nuttx/drivers/mtd/mtd_config.c5
2 files changed, 13 insertions, 6 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_bbsram.c b/nuttx/arch/arm/src/stm32/stm32_bbsram.c
index 1c2fb1d3f..c3b9e2cef 100644
--- a/nuttx/arch/arm/src/stm32/stm32_bbsram.c
+++ b/nuttx/arch/arm/src/stm32/stm32_bbsram.c
@@ -807,9 +807,9 @@ int stm32_bbsram_savepanic(int fileno, uint8_t *context, int length)
{
FAR struct bbsramfh_s *bbf;
int fill;
- int ret = -ENOMEM;
+ int ret = -ENOSPC;
- /* on a bad day we could panic while panicking, (and we debug assert)
+ /* On a bad day we could panic while panicking, (and we debug assert)
* this is a potential feeble attempt at only writing the first
* panic's context to the file
*/
@@ -826,13 +826,19 @@ int stm32_bbsram_savepanic(int fileno, uint8_t *context, int length)
DEBUGASSERT(bbf);
- /* As once ensures we will keep the first dump checking the time for
+ /* If the g_bbsram has been nulled out we return ENXIO.
+ *
+ * As once ensures we will keep the first dump. Checking the time for
* 0 protects from over writing a previous crash dump that has not
* been saved to long term storage and erased. The dreaded reboot
* loop.
*/
- if (bbf && (bbf->lastwrite.tv_sec == 0 && bbf->lastwrite.tv_nsec == 0))
+ if (!bbf)
+ {
+ ret = -ENXIO;
+ }
+ else if ((bbf->lastwrite.tv_sec == 0 && bbf->lastwrite.tv_nsec == 0))
{
/* Clamp length if too big */
diff --git a/nuttx/drivers/mtd/mtd_config.c b/nuttx/drivers/mtd/mtd_config.c
index fcf168b0d..c9162eae6 100644
--- a/nuttx/drivers/mtd/mtd_config.c
+++ b/nuttx/drivers/mtd/mtd_config.c
@@ -885,7 +885,7 @@ retry_relocate:
if (dst_offset + sizeof(hdr) >= (dst_block + 1) * dev->erasesize)
{
- /* No room at end of dst block for another header. Go to next block. */
+ /* No room at end of dst block for another header. Go to next block. */
dst_block++;
dst_offset = dst_block * dev->erasesize + CONFIGDATA_BLOCK_HDR_SIZE;
@@ -1271,7 +1271,8 @@ errout:
* Name: mtdconfig_ioctl
****************************************************************************/
-static int mtdconfig_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
+static int mtdconfig_ioctl(FAR struct file *filep, int cmd,
+ unsigned long arg)
{
FAR struct inode *inode = filep->f_inode;
FAR struct mtdconfig_struct_s *dev = inode->i_private;