Commit Graph

37878 Commits

Author SHA1 Message Date
David Sidrane
5a76767cd7 tioctl:Define SINGLEWIRE PUSHPULL option 2020-08-06 01:03:34 -05:00
Johannes Schock
a32912040f Several nxstyle fixes. 2020-08-05 08:55:54 -03:00
Johannes Schock
c760db7fd0 Kinetis K28 USBHS USB-Host. 2020-08-05 08:55:54 -03:00
Xiang Xiao
5c67eac27f libc: Change index/rindex from macro to function
to avoid the confliction with the same name variable

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-05 04:39:03 -07:00
David Sidrane
2eccc960a9 fs_cromfs:Remove duplicate case intorduced by 67ef70d 2020-08-04 21:20:25 -05:00
David Sidrane
0cc3f95bb4 nucleo-144:stm32_bbsram make coding standard compliant 2020-08-04 21:20:05 -05:00
David Sidrane
ed5d00edd8 board_crashdump:use consistent type from outer function for file name 2020-08-04 21:20:05 -05:00
Gregory Nutt
188d4b0fb4 user-space memalign() must not be called from within the OS.
drivers/net/ftmac100.c, libs/libc/stdlib/lib_aligned_alloc.c

A continuation of PRs #1507, #1510, and #1512.  See Issue #1481 for additional information.
2020-08-04 22:45:47 +01:00
Gregory Nutt
d09f6aaa72 Correct more improper use of malloc(), zalloc(), and free()
malloc() and free() should never be used within the OS. This will work in the FLAT build because there is only a single heap, but will cause problems in PROTECTED and KERNEL build modes where there are separate heaps for user and kernel memory.

Typically kmm_malloc(), kmm_zalloc(), and kmm_free() should be called within the kernel in those build modes to use the kernel heap.

Memory is never free.  Possible memory leak:

    ./boards/arm/cxd56xx/common/src/cxd56_crashdump.c:  pdump = malloc(sizeof(fullcontext_t));

Memory allocated with malloc(), but freed with kmm_free():

    ./drivers/usbhost/usbhost_composite.c:  cfgbuffer = (FAR uint8_t *)malloc(CUSTOM_CONFIG_BUFSIZE);

Memory is never freed in these cases.  It is allocated in the driver initialization logic, but there is no corresponding uninitialization logic; memory is not freed on error conditions:

    ./arch/arm/src/lc823450/lc823450_i2s.c:  priv = (struct lc823450_i2s_s *)zalloc(sizeof(struct lc823450_i2s_s));
    ./arch/arm/src/sam34/sam_spi.c:  spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
    ./arch/arm/src/sama5/sam_spi.c:  spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
    ./arch/arm/src/samv7/sam_spi.c:  spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));

Memory is allocated with zalloc() but freed on error conditions with kmm_free():

    ./arch/arm/src/sama5/sam_ssc.c:  priv = (struct sam_ssc_s *)zalloc(sizeof(struct sam_ssc_s));
    ./arch/arm/src/samv7/sam_ssc.c:  priv = (struct sam_ssc_s *)zalloc(sizeof(struct sam_ssc_s));
    ./arch/arm/src/stm32/stm32_i2s.c:  priv = (struct stm32_i2s_s *)zalloc(sizeof(struct stm32_i2s_s));

Memory is never freed:

    ./drivers/spi/spi_bitbang.c:  priv = (FAR struct spi_bitbang_s *)zalloc(sizeof(struct spi_bitbang_s));
2020-08-04 20:41:43 +01:00
Gregory Nutt
2dae970ec6 Fix cases where memory is allocated using malloc()
arch/arm/src/cxd56xx/cxd56_gnss.c, arch/arm/src/xmc4/xmc4_spi.c,
 crypto/blake2s.c, drivers/lcd/pcf8574_lcd_backpack.c, drivers/lcd/st7032.c

User space memory should not be used within the OS and, when it is absolutely necessary to use user-space memory, it should be allocated using kumm_malloc().
2020-08-04 20:40:57 +01:00
Gregory Nutt
3cad9f498f drivers/mkrd.c
drivers/net/telnet.c
 drivers/wireless/bluetooth/bt_uart_bcm4343x.c
 drivers/wireless/ieee802154/mrf24j40/mrf24j40.c

Kernel memory was allocated using kmm_malloc() or kmm_zalloc() but freed with with the user-space allocator free().  In the FLAT build, this is bad style, but not harmful because there is only a single, heap and malloc() and kmm_malloc() map to the same function.

But that is not true in the case of the PROTECTED or KERNEL builds.  In those cases, there are separate heaps.  kmm_malloc() will allocate from the kernel heap.  free() will attempt to free the kernel memory from the user heap and will cause an assertion (or other obscure failure if assertions are disabled).
2020-08-04 13:00:53 -05:00
YAMAMOTO Takashi
0b90ad3dd4 arch/sim/src/sim/up_exit.c: Appease a clang-check warning
clang-check complained like the following.
While this is not a real bug, it's easy to appease.

sim/up_exit.c:68:21: warning: Value stored to 'tcb' during its initialization is never read
  FAR struct tcb_s *tcb = this_task();
                    ^~~   ~~~~~~~~~~~
1 warning generated.
2020-08-03 22:52:31 -05:00
YAMAMOTO Takashi
123a31e3a2 drivers/usbhost/hid_parser.c: nxstyle fixes 2020-08-03 22:52:31 -05:00
YAMAMOTO Takashi
59ba52aee8 drivers/usbhost/hid_parser.c: Fix out of range array accesses
Found by clang-check:

usbhost/hid_parser.c:278:26: warning: Assigned value is garbage or undefined
                usage[i] = usage[i + 1];
                         ^ ~~~~~~~~~~~~
usbhost/hid_parser.c:321:34: warning: Assigned value is garbage or undefined
                        usage[i] = usage[i + 1];
                                 ^ ~~~~~~~~~~~~
2 warnings generated.
2020-08-03 22:52:31 -05:00
YAMAMOTO Takashi
4f7745ae1c net/tcp/tcp_timer.c: Remove redundant assignments
Found by clang-check:

tcp/tcp_timer.c:185:15: warning: Value stored to 'result' is never read
              result = tcp_callback(dev, conn, TCP_TIMEDOUT);
              ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp/tcp_timer.c:264:23: warning: Value stored to 'result' is never read
                      result = tcp_callback(dev, listener, TCP_TIMEDOUT);
                      ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp/tcp_timer.c:300:19: warning: Value stored to 'result' is never read
                  result = tcp_callback(dev, conn, TCP_TIMEDOUT);
                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
2020-08-03 22:52:31 -05:00
Masayuki Ishikawa
16cd363cb0 arch: lc823450: Replace license header with Apache License 2.0
Summary:
- This commit replaces license header under lc823450

Impact:
- No impact

Testing:
- Build check only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-08-03 21:03:41 +01:00
Masayuki Ishikawa
ea1ce2bcb6 boards: lc82345-xgevk: Replace license header with Apache License 2.0
Summary:
- This commit replaces license header under lc823450-xgevk

Impact:
- No impact

Testing:
- Build check only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-08-03 21:03:41 +01:00
Xiang Xiao
0e610caec8 fs/procfs: Handle /proc/xxx/group/ correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic9f4c38a3baf199712c5497c094dc7af84deee2c
2020-08-03 21:00:18 +01:00
Xiang Xiao
1bad139f88 fs/romfs: Support the path with tail '/' correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7ea668e50e68cb384d013349a2c8cfc2844f3b73
2020-08-03 21:00:18 +01:00
Xiang Xiao
2d7f58d165 net/procfs: Support chdir("/proc/net/") correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I47295019c6054c869545e33258ad3460896e851a
2020-08-03 21:00:18 +01:00
Xiang Xiao
2a2dd35339 arch/sim: Fix warning: implicit declaration of function ‘pthread_yield’
https://stackoverflow.com/questions/32174861/why-implicit-declaration-of-pthread-yield-with-lpthread-while-all-ok-with-pthr

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-01 14:31:49 +09:00
Alan C. Assis
c06d3e1b0a xtensa/esp32: Add SPI Flash device driver
ESP32 runs code in a SPI Flash, so users can also use it to store
data directly or mount some parts into a filesystem.

The SPI Flash usually use SPI0.

This driver was implemented by Dong Heng dongheng@espressif.com
and modified to fix coding style by Alan Carvalho de Assis.
2020-07-31 23:37:30 +01:00
spiriou
a4a9eb2f5a fs/vfs: Add file descriptor based events support 2020-07-31 15:09:35 -06:00
Johannes Schock
070f4ed7e9 FAT Filesystem: UTF8 support for long filenames, bugfixes.
New CONFIG_FAT_LFN_UTF8: UTF8 strings are converted to UCS2-LFN
Bugfix in fat_createalias: space is now also converted to underbar.
Change (bugfix) in fat_getlfname: init characters (0xff) and '\0' are rewound as well.
2020-07-31 18:01:02 -03:00
SPRESENSE
15be5e5e11 drivers/video: Store device operations table
Fix a bug which the device operation structure is not stored in
video_initialize().
2020-07-31 09:37:20 +02:00
SPRESENSE
3befe16f52 drivers/video: Support JPEG format in VIDEO_CAPTURE
Add support for the VIDEO stream with JPEG frames supported by ISX012.
2020-07-31 09:37:20 +02:00
SPRESENSE
45e9c2c8f5 drivers/video: Add 3A parameter control
Provide functions which get and set the 3A (Auto white balance/Auto
exposure/Auto
focus) parameters.
These are achieved by the ioctl request codes VIDIOC_G_EXT_CTRLS and
VIDIOC_S_EXT_CTRLS which have the following settings:

 1. ctrl_class = V4L2_CTRL_CLASS_CAMERA
 2. id         = V4L2_CID_3A_PARAMETER

Also, provide function which get the 3A adjustment status.
This is achieved by the ioctl request codes VIDIOC_G_EXT_CTRLS which has the
following settings:

 1. ctrl_class = V4L2_CTRL_CLASS_CAMERA
 2. id         = V4L2_CID_3A_STATUS
2020-07-31 09:37:20 +02:00
SPRESENSE
28ba7f4a1e boards: cxd56xx: Fix bugs about ON/OFF control of AWB and AE
Fix the following three bugs about ON/OFF control of auto white balance and auto
exposure:

 - The returned value of VIDIOC_G_CTRL with id = V4L2_CID_AUTO_WHITE_BALANCE is
different from V4L2 specification.
 - Auto exposure is locked if auto white balance lock is requested.
 - Auto exposure and auto white balance are locked if auto exposure lock is
requested.
2020-07-31 09:37:20 +02:00
SPRESENSE
f1f0378d0a boards: cxd56_imageproc.c: Add alpha blend API
Add imageproc_alpha_blend() to blend two images in a specified ratio.

The blended source image is selectable from the following two types:

 - Single color image
 - YUV422 image

The blend ratio is selectable from the following three types:

 - Blend ratio with single value
 - Blend ratio with 1bpp
 - Blend ratio with 8bpp
2020-07-31 09:37:20 +02:00
SPRESENSE
8fec8cccfc boards: cxd56_imageproc.c: Add RGB565 -> YUV422 converter
Enable to interconvert between YUV422 and RGB565.
2020-07-31 09:37:20 +02:00
SPRESENSE
8f39b20488 net/usrsock: Fix recv() couldn't peek data
Fix a bug that recv() couldn't peek receive data.
recv() would be failed by previous recv() call with MSG_PEEK.
2020-07-30 20:58:15 -05:00
Masayuki Ishikawa
4ea94c67b1 arch: lc823450: Fix style violations
Summary:
- Fix style violations under lc823450

Impact:
- Some APIs were changed but all files are included

Testing:
- Build check only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-30 20:53:02 -05:00
YAMAMOTO Takashi
9087eb6d84 net/devif/devif_callback.c: Remove a redundant assignment
Found by clang-check:

devif/devif_callback.c:508:7: warning: Value stored to 'cb' is never read
      cb = next;
      ^    ~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
b6316e9a03 libs/libc/modlib/modlib_sections.c: Remove a redundant assignment
Found by clang-check:

modlib/modlib_sections.c:93:3: warning: Value stored to 'buffer' is never read
  buffer    = loadinfo->iobuffer;
  ^           ~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
e22dffba8e fs/mqueue/mq_close.c: Remove a redundant assignment
Found by clang-check:

mqueue/mq_close.c:127:21: warning: Value stored to 'rtcb' during its initialization is never read
  FAR struct tcb_s *rtcb = (FAR struct tcb_s *)nxsched_self();
                    ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
39ed1417d8 lib_libfread.c: Replace Gregory Nutt's copyright notice with Apache 2.0
The new license text was copied from sched_getcpu.c.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
15590005d0 lib_libfread.c: nxstyle fixes 2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
d02354c766 libs/libc/stdio/lib_libfread.c: Remove a redundant assignment
Found by clang-check:

stdio/lib_libfread.c:75:7: warning: Value stored to 'bytes_read' is never read
      bytes_read = -1;
      ^            ~~
1 warning generated.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
8b0d42275e sched/sched/sched_waitpid.c: Remove a redundant assignment
Found by clang-check:

sched/sched_waitpid.c:380:33: warning: Although the value stored to 'ret' is used in the enclosing expression, the value is never actually read from 'ret'
          (pid != (pid_t)-1 && (ret = nxsig_kill(pid, 0)) < 0))
                                ^     ~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
bf9ba474a5 net/icmp/icmp_recvfrom.c: fix a NULL dereference
Found by clang-check:

icmp/icmp_recvfrom.c:374:30: warning: Dereference of null pointer (loaded from variable 'fromlen')
      if (fromlen == NULL && *fromlen < sizeof(struct sockaddr_in))
                             ^~~~~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
1078210f7f fs/mount/fs_mount.c: Remove a redandunt assignment
Found by clang-check:

mount/fs_mount.c:287:8: warning: Although the value stored to 'ret' is used in
      the enclosing expression, the value is never actually read from 'ret'
      (ret = find_blockdriver(source, mountflags, &drvr_inode)) >= 0)
       ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-07-30 08:59:46 +02:00
YAMAMOTO Takashi
dc6b61caf9 fs/romfs/fs_romfs.c: Remove redundant assignments
Found by clang-check:

romfs/fs_romfs.c:431:7: warning: Value stored to 'bytesread' is never read
      bytesread  = 0;
      ^            ~
romfs/fs_romfs.c:455:11: warning: Value stored to 'sector' is never read
          sector    += nsectors;
          ^            ~~~~~~~~
2 warnings generated.
2020-07-30 08:59:46 +02:00
YAMAMOTO Takashi
ba4a7107df fs/hostfs/hostfs.c: Remove a redundant assignment
Found by clang-check:

hostfs/hostfs.c:1081:3: warning: Value stored to 'ret' is never read
  ret = OK; /* Assume success */
  ^     ~~
1 warning generated.
2020-07-30 08:59:46 +02:00
Ouss4
e79298bc34 tools/Config.mk: Unquote the custom board path before using it in
Makefile functions.
2020-07-30 00:10:29 -05:00
Ouss4
708daf2c3d tools/Config.mk: Remove CONFIG_ARCH_BOARD from BOARD_DIR when using a
custom board.

Custom boards don't set CONFIG_ARCH_BOARD since the full path is given
during configuration.
Furthermore this creates problems when when referencing other
folders using BOARD_DIR because a trailing DELIM will be present.
2020-07-30 00:10:29 -05:00
Masayuki Ishikawa
336bd8c3a2 arch: lc823450: Fix style violations
Summary:
- Fix style violations under lc823450
- NOTE: still some files need to be fixed

Impact:
- Some register naming were changed but all files are included

Testing:
- Build check only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-30 00:07:31 -05:00
Masayuki Ishikawa
22a9b497b1 arch: lc823450: Fix style violations in lc823450_syscontrol.h
Summary:
- Fix style violations in lc823450_syscontrol.h

Impact:
- This commit affects register naming in syscontrol.
- So some files such as lc823450_start.c lc823450_mux.c were also changed.

Testing:
- Build check only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-30 00:07:31 -05:00
Masayuki Ishikawa
f255f4f97d boards: lc823450-xgevk: Fix style violations
Summary:
- Fix style violations under lc823450-xgevk

Impact:
- No impact

Testing:
- Build check only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-30 00:07:31 -05:00
YAMAMOTO Takashi
1a669e09cd drivers/syslog/syslog_write.c: nxstyle fix 2020-07-29 21:13:20 -07:00
YAMAMOTO Takashi
9274b67a45 syslog_default_write: Fix the return value
Found by clang-check:

syslog/syslog_write.c:96:7: warning: Value stored to 'nwritten' is never read
      nwritten = g_syslog_channel->sc_write(buffer, buflen);
      ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-07-29 21:13:20 -07:00