diff options
author | Andrew Tridgell <tridge@samba.org> | 2013-12-10 15:09:36 +1100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-12-10 11:40:51 +0100 |
commit | b3f4b0a240bfb9d7dfaafd78d0a6bbca1c429f60 (patch) | |
tree | e03148184d2dd883e30097b0109b6859094ea55d /src | |
parent | 893d66d9613c699c9e891e23bc78a61fcc5ad7b4 (diff) | |
download | px4-firmware-b3f4b0a240bfb9d7dfaafd78d0a6bbca1c429f60.tar.gz px4-firmware-b3f4b0a240bfb9d7dfaafd78d0a6bbca1c429f60.tar.bz2 px4-firmware-b3f4b0a240bfb9d7dfaafd78d0a6bbca1c429f60.zip |
drv_hrt: added note on why an uninitialised hrt_call is safe
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/stm32/drv_hrt.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/drivers/stm32/drv_hrt.c b/src/drivers/stm32/drv_hrt.c index dc28f446b..1bd251bc2 100644 --- a/src/drivers/stm32/drv_hrt.c +++ b/src/drivers/stm32/drv_hrt.c @@ -720,7 +720,6 @@ hrt_call_at(struct hrt_call *entry, hrt_abstime calltime, hrt_callout callout, v void hrt_call_every(struct hrt_call *entry, hrt_abstime delay, hrt_abstime interval, hrt_callout callout, void *arg) { - hrt_call_init(entry); hrt_call_internal(entry, hrt_absolute_time() + delay, interval, @@ -734,6 +733,13 @@ hrt_call_internal(struct hrt_call *entry, hrt_abstime deadline, hrt_abstime inte irqstate_t flags = irqsave(); /* if the entry is currently queued, remove it */ + /* note that we are using a potentially uninitialised + entry->link here, but it is safe as sq_rem() doesn't + dereference the passed node unless it is found in the + list. So we potentially waste a bit of time searching the + queue for the uninitialised entry->link but we don't do + anything actually unsafe. + */ if (entry->deadline != 0) sq_rem(&entry->link, &callout_queue); |