Unplugging a USB device from an OHCI root hub will cause
a deadlock if DRVR_EPFREE is called from sam_rhsc_bottomhalf. A
typical call chain looks like this: sam_rhsc_bottomhalf->
CLASS_DISCONNECTED->usbhost_destroy->DRVR_EPFREE. In this case
DRVR_EPFREE tries to lock a locked mutex. A recursive mutex
prevents this deadlock.
This change introduce 2 items:
1. If the size of the space requested is 0, the behavior is implementation-defined:
either a null pointer shall be returned, or the behavior shall be as if the size
were some non-zero value, except that the behavior is undefined if the returned
pointer is used to access an object.
Change the behavior to be similar to Linux and Android and allocates an object
of a minimum size instead of returning null pointer.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.htmlhttps://pubs.opengroup.org/onlinepubs/9699919799/functions/calloc.htmlhttps://pubs.opengroup.org/onlinepubs/9699919799/functions/realloc.html
2. The description of realloc() has been modified from previous versions of this
standard to align with the ISO/IEC 9899:1999 standard. Previous versions explicitly
permitted a call to realloc (p, 0) to free the space pointed to by p and return
a null pointer. While this behavior could be interpreted as permitted by this
version of the standard, the C language committee have indicated that this
interpretation is incorrect. Applications should assume that if realloc() returns
a null pointer, the space pointed to by p has not been freed. Since this could lead
to double-frees, implementations should also set errno if a null pointer actually
indicates a failure, and applications should only free the space if errno was changed.
Do not free memory of zero-length reallocation is requested
https://pubs.opengroup.org/onlinepubs/9699919799/functions/realloc.html
Co-authored-by: fangxinyong <fangxinyong@xiaomi.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
* 'pcm_dump' available if 'CONFIG_DEBUG_AUDIO_INFO' is set
instead of using the 'CONFIG_PCM_DEBUG'.
* 'pcm_leuint16' and 'pcm_leuint32' available if
'CONFIG_AUDIO_FORMAT_RAW' is not set (once 'pcm_parsewav', which
is available under the same condition, use them).
* 'headersize' var, from 'pcm_enqueuebuffer' declared only if
'CONFIG_AUDIO_FORMAT_RAW' is not set (as it's used by the code
defined by the same condition).
Since not all nand devices follow ONFI spec, nand_raw_initialize could be used to skip ONFI special action
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
The setbuffer() function is a wrapper around setvbuf() which
enables full buffering on a buffer allocated by the caller, assuming
buffer is not a null pointer.
The defconfigs that test PSRAM on ESP32 contain the `ramtest` app,
but it doesn't test the memory correctly as it try to access the
memory directly. The memory, however, is being used by the system's
heap and `ramtest` can mess with it. Therefore, it makes sense to
test using `mm` testing app.
Current driver supports MTDIOC_BULKERASE ioctl that erases the entire
device. The added ioctl MTDIOC_ERASESECTORS adds possibility to erase
just sectors defined by the user.
This is similar to MEMERASE call in Linux kernel.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Add the `IW_AUTH_WPA_VERSION_WPA3` bit field to support selecting
WPA3-SAE networks using the `IW_AUTH_WPA_VERSION` command.
This commit is necessary to enable `wapi`'s support for WPA3.
Summary:
- I noticed that mtu info with ifconfig shows incorrect size.
- This commit fixes this issue.
Impact:
- None
Testing:
- Tested with spresense:wifi_smp
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
I noticed sometimes once config changed, it will not launch to shell,
maybe due to
K210 is a 64-bit platform and without misaligned memory access support.
This patch may fix this problem, it will not introduce new issues at least.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Similar to the fix introduced by
4d6a8663fa, it's necessary to set
one end of the file_pipe as non-blocking temporarily while opening
the other end to avoid it blocking unexpectedily.
The spawn proxy thread is a special existence in NuttX, usually some developers
spend a lot of time on stack overflow of spawn proxy thread:
https://github.com/apache/nuttx/issues/9046https://github.com/apache/nuttx/pull/9081
In order to avoid similar issues, this PR will remove spawn proxy thread to simplify
the process of task/posix_spawn().
1. Postpone the related processing of spawn file actions until after task_init()
2. Delete the temporary thread of spawn proxy and related global variables
Signed-off-by: chao an <anchao@xiaomi.com>
minidump will backtrace failure when use C code to save user context,
because the stack push operation in C code can disrupt the stack information.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Add private data for spi_bitbang low-level driver to add an instance
specific private data.
And add spi_destroy_bitbang() to clean up a driver instance.
1. stack_alloc_ptr should be freed in kernel mode
2. replace nxsched_release_tcb() to nxtask_uninit() to remove tcb from inactive list
Signed-off-by: chao an <anchao@xiaomi.com>