Message ID | 1464219423-14977-11-git-send-email-bill.fischofer@linaro.org |
---|---|
State | Superseded |
Headers | show |
On 05/26/16 02:37, Bill Fischofer wrote: > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > platform/linux-generic/odp_traffic_mngr.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c > index f8995b4..51cfe67 100644 > --- a/platform/linux-generic/odp_traffic_mngr.c > +++ b/platform/linux-generic/odp_traffic_mngr.c > @@ -2171,7 +2171,8 @@ static int tm_process_expired_timers(tm_system_t *tm_system, > (tm_queue_obj->timer_reason == NO_CALLBACK) || > (!tm_queue_obj->timer_shaper) || > (tm_queue_obj->timer_seq != timer_seq)) { > - if (tm_queue_obj->timer_cancels_outstanding != 0) > + if (tm_queue_obj && > + tm_queue_obj->timer_cancels_outstanding != 0) I think it's better to simplity such kind of check for more easy reading and error handling: tm_queue_obj = tm_system->queue_num_tbl[queue_num]; if ((!tm_queue_obj) || (tm_queue_obj->timer_reason == NO_CALLBACK) || (!tm_queue_obj->timer_shaper) || (tm_queue_obj->timer_seq != timer_seq)) { if (tm_queue_obj->timer_cancels_outstanding != 0) tm_queue_obj->timer_cancels_outstanding--; else printf("%s bad timer return\n", __func__); return work_done; } that can be: tm_queue_obj = tm_system->queue_num_tbl[queue_num]; if (!tm_queue_obj) return work_done; if (tm_queue_obj->timer_reason == NO_CALLBACK) || (!tm_queue_obj->timer_shaper) || (tm_queue_obj->timer_seq != timer_seq)) { if (tm_queue_obj->timer_cancels_outstanding != 0) tm_queue_obj->timer_cancels_outstanding--; else printf("%s bad timer return\n", __func__); return work_done; } Maxim. > tm_queue_obj->timer_cancels_outstanding--; > else > printf("%s bad timer return\n", __func__);
diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index f8995b4..51cfe67 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -2171,7 +2171,8 @@ static int tm_process_expired_timers(tm_system_t *tm_system, (tm_queue_obj->timer_reason == NO_CALLBACK) || (!tm_queue_obj->timer_shaper) || (tm_queue_obj->timer_seq != timer_seq)) { - if (tm_queue_obj->timer_cancels_outstanding != 0) + if (tm_queue_obj && + tm_queue_obj->timer_cancels_outstanding != 0) tm_queue_obj->timer_cancels_outstanding--; else printf("%s bad timer return\n", __func__);
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- platform/linux-generic/odp_traffic_mngr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)