mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Fix some BBRAM return values (from David Sidrane). Also some MTD-related cosmetic changes
This commit is contained in:
@@ -807,9 +807,9 @@ int stm32_bbsram_savepanic(int fileno, uint8_t *context, int length)
|
|||||||
{
|
{
|
||||||
FAR struct bbsramfh_s *bbf;
|
FAR struct bbsramfh_s *bbf;
|
||||||
int fill;
|
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
|
* this is a potential feeble attempt at only writing the first
|
||||||
* panic's context to the file
|
* panic's context to the file
|
||||||
*/
|
*/
|
||||||
@@ -826,13 +826,19 @@ int stm32_bbsram_savepanic(int fileno, uint8_t *context, int length)
|
|||||||
|
|
||||||
DEBUGASSERT(bbf);
|
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
|
* 0 protects from over writing a previous crash dump that has not
|
||||||
* been saved to long term storage and erased. The dreaded reboot
|
* been saved to long term storage and erased. The dreaded reboot
|
||||||
* loop.
|
* 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 */
|
/* Clamp length if too big */
|
||||||
|
|
||||||
|
|||||||
@@ -885,7 +885,7 @@ retry_relocate:
|
|||||||
|
|
||||||
if (dst_offset + sizeof(hdr) >= (dst_block + 1) * dev->erasesize)
|
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_block++;
|
||||||
dst_offset = dst_block * dev->erasesize + CONFIGDATA_BLOCK_HDR_SIZE;
|
dst_offset = dst_block * dev->erasesize + CONFIGDATA_BLOCK_HDR_SIZE;
|
||||||
@@ -1271,7 +1271,8 @@ errout:
|
|||||||
* Name: mtdconfig_ioctl
|
* 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 inode *inode = filep->f_inode;
|
||||||
FAR struct mtdconfig_struct_s *dev = inode->i_private;
|
FAR struct mtdconfig_struct_s *dev = inode->i_private;
|
||||||
|
|||||||
Reference in New Issue
Block a user