fix rt_atomic_dec_and_test

This commit is contained in:
zhao maosheng 2024-08-01 11:20:14 +08:00 committed by Bernard Xiong
parent 8c5f24469c
commit f543160ead
2 changed files with 5 additions and 1 deletions

View File

@ -206,6 +206,8 @@ static int platform_ofw_device_probe(void)
if (ofw_node_root) if (ofw_node_root)
{ {
rt_ofw_node_get(ofw_node_root);
err = platform_ofw_device_probe_once(ofw_node_root); err = platform_ofw_device_probe_once(ofw_node_root);
rt_ofw_node_put(ofw_node_root); rt_ofw_node_put(ofw_node_root);
@ -216,11 +218,13 @@ static int platform_ofw_device_probe(void)
rt_ofw_node_put(node); rt_ofw_node_put(node);
} }
rt_ofw_node_get(ofw_node_chosen);
if ((node = rt_ofw_get_child_by_compatible(ofw_node_chosen, "simple-framebuffer"))) if ((node = rt_ofw_get_child_by_compatible(ofw_node_chosen, "simple-framebuffer")))
{ {
platform_ofw_device_probe_once(node); platform_ofw_device_probe_once(node);
rt_ofw_node_put(node); rt_ofw_node_put(node);
} }
rt_ofw_node_get(ofw_node_chosen);
} }
else else
{ {

View File

@ -203,7 +203,7 @@ rt_inline rt_atomic_t rt_soft_atomic_compare_exchange_strong(volatile rt_atomic_
rt_inline rt_bool_t rt_atomic_dec_and_test(volatile rt_atomic_t *ptr) rt_inline rt_bool_t rt_atomic_dec_and_test(volatile rt_atomic_t *ptr)
{ {
return rt_atomic_sub(ptr, 1) == 0; return rt_atomic_sub(ptr, 1) == 1;
} }
rt_inline rt_atomic_t rt_atomic_fetch_add_unless(volatile rt_atomic_t *ptr, rt_atomic_t a, rt_atomic_t u) rt_inline rt_atomic_t rt_atomic_fetch_add_unless(volatile rt_atomic_t *ptr, rt_atomic_t a, rt_atomic_t u)