Print this page
new smatch


 109 static void push_state_at_start(struct smatch_state *state)
 110 {
 111         add_ptr_list(&state_at_start, state);
 112 }
 113 
 114 static struct smatch_state *pop_state_at_start(void)
 115 {
 116         struct smatch_state *state;
 117 
 118         state = last_ptr_list((struct ptr_list *)state_at_start);
 119         delete_ptr_list_last((struct ptr_list **)&state_at_start);
 120         return state;
 121 }
 122 
 123 static void before_loop(struct statement *stmt)
 124 {
 125         struct smatch_state *state;
 126 
 127         if (!stmt || stmt->type != STMT_ITERATOR)
 128                 return;
 129         if (ptr_list_empty(state_at_start))
 130                 returned = 0;
 131         state = get_state(my_id, "depends on", NULL);
 132         push_state_at_start(state);
 133 }
 134 
 135 static void after_loop(struct statement *stmt)
 136 {
 137         struct smatch_state *old_state;
 138 
 139         if (!stmt || stmt->type != STMT_ITERATOR)
 140                 return;
 141         old_state = pop_state_at_start();
 142         if (old_state == &readl_00)
 143                 return;
 144         if (returned)
 145                 return;
 146         if (get_state(my_id, "depends on", NULL) != &readl_00)
 147                 return;
 148         sm_warning("this loop depends on readl() succeeding");
 149 }


 109 static void push_state_at_start(struct smatch_state *state)
 110 {
 111         add_ptr_list(&state_at_start, state);
 112 }
 113 
 114 static struct smatch_state *pop_state_at_start(void)
 115 {
 116         struct smatch_state *state;
 117 
 118         state = last_ptr_list((struct ptr_list *)state_at_start);
 119         delete_ptr_list_last((struct ptr_list **)&state_at_start);
 120         return state;
 121 }
 122 
 123 static void before_loop(struct statement *stmt)
 124 {
 125         struct smatch_state *state;
 126 
 127         if (!stmt || stmt->type != STMT_ITERATOR)
 128                 return;
 129         if (ptr_list_empty((struct ptr_list *)state_at_start))
 130                 returned = 0;
 131         state = get_state(my_id, "depends on", NULL);
 132         push_state_at_start(state);
 133 }
 134 
 135 static void after_loop(struct statement *stmt)
 136 {
 137         struct smatch_state *old_state;
 138 
 139         if (!stmt || stmt->type != STMT_ITERATOR)
 140                 return;
 141         old_state = pop_state_at_start();
 142         if (old_state == &readl_00)
 143                 return;
 144         if (returned)
 145                 return;
 146         if (get_state(my_id, "depends on", NULL) != &readl_00)
 147                 return;
 148         sm_warning("this loop depends on readl() succeeding");
 149 }