This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new e49a37f hw/bus: Add missing debug checks
e49a37f is described below
commit e49a37fc372184d4502432b0dcac1ecfb913ce8e
Author: Andrzej Kaczmarek <[email protected]>
AuthorDate: Mon Aug 3 20:32:26 2020 +0200
hw/bus: Add missing debug checks
We should check if APIs are called on proper objects - this is only
valid if "BUS_DEBUG_OS_DEV: 1".
---
hw/bus/src/bus.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/bus/src/bus.c b/hw/bus/src/bus.c
index b1ce680..149a8da 100644
--- a/hw/bus/src/bus.c
+++ b/hw/bus/src/bus.c
@@ -540,6 +540,8 @@ bus_node_get_lock_timeout(struct os_dev *node)
{
struct bus_node *bnode = (struct bus_node *)node;
+ BUS_DEBUG_VERIFY_NODE(bnode);
+
return bnode->lock_timeout ? bnode->lock_timeout : g_bus_node_lock_timeout;
}
@@ -551,6 +553,8 @@ bus_dev_set_pm(struct os_dev *bus, bus_pm_mode_t pm_mode,
struct bus_dev *bdev = (struct bus_dev *)bus;
int rc;
+ BUS_DEBUG_VERIFY_DEV(bdev);
+
rc = os_mutex_pend(&bdev->lock, OS_TIMEOUT_NEVER);
if (rc) {
return SYS_EACCES;