Commit graph

99049 commits

Author SHA1 Message Date
Gil Pitney
508c941d32 drivers: wifi: simplelink: fix Coverity issue in getaddrinfo()
Check for case where host == NULL but service != NULL
could have resulted later in a NULL dereference.

Coverity-CID: 189516
Fixes #11090

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-11-08 23:23:23 +02:00
Paul Sokolovsky
53153405aa lib: fdtable: File descriptor table should reside in kernel memory
Private kernel data structure which should not be accessible to
userspace threads. Mark with __kernel.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-11-08 09:47:46 -08:00
Paul Sokolovsky
8f690e291b lib: fdtable: FD method tables should be const.
FD method tables contain function pointers, and thus should be
const and reside in ROM. This patch fixes all cases of FD vtable
definitions: for POSIX FS API and for sockets.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-11-08 09:47:46 -08:00
Andrei Emeltchenko
93bd26343e usb: logs: Rename USB_WRN to LOG_WRN
Since logger is now suitable for our logs use it directly.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-08 08:35:20 -05:00
Andrei Emeltchenko
f22060cdbe usb: logs: Rename USB_INF to LOG_INF
Since logger is now suitable for our logs use it directly.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-08 08:35:20 -05:00
Andrei Emeltchenko
17f7abd3dc usb: logs: Rename USB_ERR to LOG_ERR
Since logger is now suitable for our logs use it directly.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-08 08:35:20 -05:00
Andrei Emeltchenko
92c7ab74c0 usb: logs: Rename USB_DBG to LOG_DBG
Since logger is now suitable for our logs use it directly.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-08 08:35:20 -05:00
Andrei Emeltchenko
c579414263 usb: Do not include function name twice
When CONFIG_LOG_FUNCTION_NAME is defined to not add name again.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-08 08:35:20 -05:00
Sean Nyekjaer
c206b0239f drivers: gpio: shell: rectify gpio get error msg
Previous the error for get was:
- Wrong parameters for set
Now:
- Wrong parameters for get

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
2018-11-08 08:25:06 -05:00
Jukka Rissanen
6c64cb9e67 tests: net: ethernet_mgmt: Enable IPv6 for this test
IPv6 is needed as there is special handling of IPv6 addresses
when MAC address is changed. We do not need DAD + other IPv6
specific features so those are disabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-08 15:23:05 +02:00
Jukka Rissanen
42c180ed5b net: eth: Remove old IPv6 interface identifier address
If we change the ethernet MAC address, then we must also remove
the old IPv6 interface identifier (iid) address from the
interface. Otherwise there might not be enough space in the IPv6
address array for the new iid address and beside the old iid
address is not useful any more after the MAC address is changed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-08 15:23:05 +02:00
Jukka Rissanen
aa5f219bd1 net: if: Allow calling IPv4 specific functions
Make sure that IPv4 specific functions are callable even if
IPv4 is not enabled. This allows use of IS_ENABLED() macro
in other parts of the system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-08 15:23:05 +02:00
Jukka Rissanen
2808b23f44 net: if: Allow calling IPv6 specific functions
Make sure that IPv6 specific functions are callable even if
IPv6 is not enabled. This allows use of IS_ENABLED() macro
in other parts of the system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-08 15:23:05 +02:00
Benoit Leforestier
270ec15482 board: Add support of STM32F143xG SOC
The only difference between the F413xH and F413xG is flash memory size.
STMF413xH: 1536 Kbytes
STMF413xG: 1024 Kbytes

Signed-off-by: Benoit Leforestier <benoit.leforestier@gmail.com>
2018-11-08 07:05:04 -06:00
Szymon Janc
602e08c69a Bluetooth: host: Don't restart scan if connection is pending
With multiple devices on auto-connect list it is possible that while
having pending connection to device A, device B disconnects. In that
case host should not try to start scan (currently controller doesn't
support concurrent scanning and initiating).

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2018-11-08 14:21:21 +02:00
Himanshu Jha
148d515f9b samples: flash_shell: Replace incorrect assignment to boolean expression
`shell_cmd_precheck()` function has the second argument as boolean
and currently we pass assignment expression instead of boolean
expression. Therefore, fix the expression by passing `argc == 2`
as the boolean argument.

Fixes #11099
Coverity-CID: 189507

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-08 10:46:17 +01:00
Sathish Kuttan
c91faf9008 drivers: dmic: Intel PDM digital mic driver
Added an implementation of driver for Intel PDM digital microphone
controller .

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-08 00:40:28 -05:00
Maureen Helm
4ab023d31f doc: Fix licensing links for cmsis, nordic, and mcux components
Fixes broken licensing links for the cmsis, nordic, and mcux external
components. Updates the cmsis license to Apache 2.0 now that we're using
cmsis version 5.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-11-07 22:57:50 -05:00
Maureen Helm
f379abfe47 drivers: sensor: Fix missing case break in fxos8700 driver
Fixes a missing case break in the fxos8700 sensor driver, caught by
Coverity.

Coverity-CID: 189517

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-11-07 19:23:46 -05:00
Himanshu Jha
b7515ab015 drivers: audio: Use ARRAY_SIZE helper macro
Use ARRAY_SIZE helper macro to compute size of array rather
than hardcoding.

Also, remove unnecessary variable to store the size which is
now useless.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 16:56:33 -05:00
Carles Cufi
f803a25ec1 doc: bluetooth: Add existing qualification listings
List the currently available Bluetooth Qualification Listings for the
Zephyr Host and Controller.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-11-07 15:30:34 -05:00
Harry Jiang
f78a996df8 board: stm32_min_dev: Add PWM support
Add support PWM 1 to stm32_min_dev board

Signed-off-by: Harry Jiang <explora26@gmail.com>
2018-11-07 13:54:51 -06:00
Emanuele Di Santo
7e8b44f774 subsys: bluetooth: services: dev. information service enhancements
This commit moves the BLE GATT Device Information service
from /samples/bluetooth/gatt to /subsys/bluetooth/services and adds
a Kconfig entry to enable and configure the service;
when enabled, it will register itself automatically.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2018-11-07 18:08:05 +01:00
Himanshu Jha
58781d5782 coccinelle: Add script to check legal usage of sizeof expression
sizeof when applied to a pointer typed expression gives the size of
the pointer and not the size of the object associated with the pointer
expression leading to errors.

This scripts checks for inconsistencies where sizeof is incorrectly
used, especially while calculating size of memory to be allocated in
memory allocating functions.

Eg:

-	memset(pStr, 0, sizeof(pStr));
+	memset(pStr, 0, sizeof(*pStr));

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:34:24 -05:00
Himanshu Jha
d0a98b7cf9 drivers: Remove redundant semicolon
Remove the redundant semicolon used as a terminator in
`if`, `switch`, `while` statements.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:34:06 -05:00
Himanshu Jha
1e3e10cfa8 coccinelle: Add script to remove redundant semicolon
This script allowes to remove the redundant semicolon from
`if`, `switch`, `while`, `for` statements.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:34:06 -05:00
Himanshu Jha
6f2c7eed49 coccinelle: Add script to find cases of unsigned < 0
Unsigned expressions cannot be less than zero and presence
of such practices very likely indicates a bug.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:33:43 -05:00
Himanshu Jha
1df011c8e2 coccinelle: Add script to find cases of missing locks
This script finds cases of missing locks in the code.
There is some possibilty of false positives in cases
where a particular function is supposed to exit with
the lock held or there is any preceding function call
that releases the lock.

Suggested-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:32:59 -05:00
Himanshu Jha
6f98ae38a2 coccinelle: irq_lock.cocci: Update script
* Provide a single liner description at top using `///`
  comments. This one liner is displayed when using `--verbose`
  mode of coccicheck.

* Specify Condidence level property adhering to coccinelle.rst
  section "Proposing new semantic patches".

* Add virtual patch rule to handle the patch case when coccicheck
  is supplied with `--mode=patch` option.

* Add `depends on !(file in "ext")` to ignore reports from `ext/`
  directory.

* Simplify rule to use disjunctions and use "exists" to match any
  available control path.

Suggested-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:31:41 -05:00
Himanshu Jha
ff5a8a85e1 coccinelle: ignore_return.cocci: Update script
* Provide a single liner description at top using `///`
  comments. This one liner is displayed when using `--verbose`
  mode of coccicheck.

* Specify Condidence level property adhering to coccinelle.rst
  section "Proposing new semantic patches".

* Add virtual patch rule to handle the patch case when coccicheck
  is supplied with `--mode=patch` option.

* Add `depends on !(file in "ext")` to ignore reports from `ext/`
  directory.

* Simplify patch rule to reduce effort in reconstruction since
  logically we are only *adding* void cast.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:30:11 -05:00
Himanshu Jha
6aaba6842b coccinelle: Add script to report cases of NULL dereference
This script finds cases of NULL dereferences where a variable
is dereferenced under a NULL test, even though it is known
to be NULL.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:28:58 -05:00
Himanshu Jha
060414704b coccinelle: unsigned_shift.cocci: Update script
* Use `expression` metavariable instead of `constant` to catch
  missing cases such as:

diff -u -p a/subsys/net/ip/rpl.c b/subsys/net/ip/rpl.c
--- a/subsys/net/ip/rpl.c
+++ b/subsys/net/ip/rpl.c
@@ -686,7 +686,7 @@ static void new_dio_interval(struct net_
 {
 	u32_t time;

-	time = 1 << instance->dio_interval_current;
+	time = BIT(instance->dio_interval_current);

* Provide a single liner description at top using `///`
  comments. This one liner is displayed when using `--verbose`
  mode of coccicheck.

* Specify Condidence level property adhering to coccinelle.rst
  section "Proposing new semantic patches".

* Add virtual patch rule to handle the patch case when coccicheck
  is supplied with `--mode=patch` option.

* Edit patch rule to remove redundant parentheses in the output.

* Add `depends on !(file in "ext")` to ignore reports from `ext/`
  directory.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:27:44 -05:00
Himanshu Jha
39c3c4e020 CODEOWNERS: Update list to add scripts/coccinelle/ directory
Add missing directory `scripts/coccinelle/` to the maintainer
list of Coccinelle Infrastructure, which was assigned
recently in commit d88421db37

This directory is used to add new coccinelle scripts.

Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 08:19:14 -05:00
Harry Jiang
59b772575f board: stm32_min_dev: Add I2C support
Add support I2C 1 to stm32_min_dev board

Signed-off-by: Harry Jiang <explora26@gmail.com>
2018-11-07 06:55:36 -06:00
Martin Benda
4a2837f866 arch: arm: sam0: enable SEGGER RTT on Atmel sam0 SoCs
Add `select HAS_SEGGER_RTT` under `SOC_FAMILY_SAM0`.

Signed-off-by: Martin Benda <martin.benda@omsquare.com>
2018-11-07 06:42:02 -06:00
Michael Scott
6575e84002 logging: start log processing thread in enable_logger()
Currently, if CONFIG_LOG_PROCESS_THREAD is enabled, log processing
does not start until just before the main() function is called in
the user sample.  This means that no real-time logging information
will be sent to the backends while drivers and/or other processes
which are triggered during kernel boot are processing their tasks.
Worse, if they take a longish time to finish, the user is
presented with a blank log backend regardless of the debug levels.

Let's start processing logs earlier to avoid this issue.

NOTE: Since this thread is now triggered specifically rather than
started during static thread init, let's also name it.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-07 14:39:55 +02:00
Mariusz Skamra
9a69cfbf19 mgmt: Add function to unregister GATT service
This adds a possibility to unregister GATT SMP service.
Using this function, device can disable Firmware Update
functionality, if not needed.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-11-07 14:35:22 +02:00
Ravi kumar Veeramally
a34d14b03c net: samples: Remove semaphore from sntp_client
Issue found using Coccinelle. Semaphore is not required at all
in this application.

Fixes #11150

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-11-07 14:34:52 +02:00
Zhang WenChao
93d3065235 samples: application_development: fix #11074
external_lib using the wrong ar

Signed-off-by: Zhang WenChao <zhangwenchao001@gmail.com>
2018-11-07 12:04:04 +01:00
Szymon Janc
16fe6c5473 Bluetooth: host: Add comment clarifying L2CAP fallback for CPUP
Makes it easier to understand reason for else branch.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2018-11-07 13:01:01 +02:00
Vinayak Kariappa Chettimada
f403bfa343 Bluetooth: controller: Add min & max interval support in CPR
Add support for exchanging both minimum and maximum
connection interval values in Connection Parameter Request
Procedure implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-11-06 20:56:13 -05:00
Kumar Gala
37f911375a Kconfig: dts: Move HAS_DTS to arch level
Remove either duplicate settings between arch & board, or just set
HAS_DTS at the arch level since all the boards for a given arch support
DTS now.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-06 18:35:39 -05:00
Jakub Rzeszutko
59c23b11ff shell: wildcard active by default
Wildcard plugin is active by default.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-11-06 17:12:41 -05:00
Krzysztof Chruscinski
4962618e5f shell: shell_uart: add ring_buffers and interrupt support
Improved RX path to use ring buffer for incoming data instead of single
byte buffer. Improved TX path to use ring buffer. Added support for
asynchronous UART API (interrupts).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-11-06 17:11:26 -05:00
Anas Nashif
79095099bb samples: bmg160: use default log level
Do not use debug level by default. It will not fit on some devices with
small RAM.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-06 17:09:25 -05:00
Aurelien Jarno
2eeff9aab0 subsys: nvs: increase NVS_BLOCK_SIZE
The Atmel SAM E70 flash has a 16-byte write block size. Increase the
NVS_BLOCK_SIZE a bit and take some margin. This might also improve the
performances by reducing the calls to the flash driver when moving data
during garbage collection.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-06 17:09:03 -05:00
Aurelien Jarno
523caef224 subsys: nvs: fix ATE read/write when write block size > 8 bytes
When the write block size is bigger than sizeof(nvs_ate), which is 8
bytes, we should not read or write more than the ATE. The
_nvs_flash_al_wrt() function will take care of padding the write with
0xff up to write_block_size. Of course the addresses should still be
incremented by write_block_size.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-06 17:09:03 -05:00
Aurelien Jarno
199309dbf5 subsys: nvs: kill a VLA
VLA are usually not recommended and are a MISRA C violation. Replace
fs->write_block_size by NVS_BLOCK_SIZE as we now have a check at
initialization that ensures that fs->write_block_size <= NVS_BLOCK_SIZE.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-06 17:09:03 -05:00
Aurelien Jarno
da2495e914 subsys: nvs: error out if write block size is not supported
In case the write block size is bigger than NVS_BLOCK_SIZE, some
functions end up in an endless loop. Detect the unsupported cases
at initialization.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-06 17:09:03 -05:00
Johan Hedberg
899d704dee Bluetooth: Add basic documentation for address types
The Bluetooth address types were not documented, causing warnings from
Doxygen.

Fixes #3524

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-06 16:58:26 -05:00