struct tc_action *a;
        int ret = 0, i;
 
-       for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) {
-               a = actions[i];
+       tcf_act_for_each_action(i, a, actions) {
                actions[i] = NULL;
                ops = a->ops;
                ret = __tcf_idr_release(a, bind, true);
        int err = -EINVAL, i;
        struct nlattr *nest;
 
-       for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) {
-               a = actions[i];
+       tcf_act_for_each_action(i, a, actions) {
                nest = nla_nest_start_noflag(skb, i + 1);
                if (nest == NULL)
                        goto nla_put_failure;
 
 static int tcf_action_delete(struct net *net, struct tc_action *actions[])
 {
+       struct tc_action *a;
        int i;
 
-       for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) {
-               struct tc_action *a = actions[i];
+       tcf_act_for_each_action(i, a, actions) {
                const struct tc_action_ops *ops = a->ops;
                /* Actions can be deleted concurrently so we must save their
                 * type and id to search again after reference is released.
                if (tcf_action_put(a)) {
                        /* last reference, action was deleted concurrently */
                        module_put(ops->owner);
-               } else  {
+               } else {
                        int ret;
 
                        /* now do the delete */