struct dsa_port *to_dp;
        int err;
 
+       if (cls->common.protocol != htons(ETH_P_ALL))
+               return -EOPNOTSUPP;
+
        if (!ds->ops->port_mirror_add)
                return -EOPNOTSUPP;
 
                                     struct tc_cls_matchall_offload *cls,
                                     bool ingress)
 {
-       int err = -EOPNOTSUPP;
+       const struct flow_action *action = &cls->rule->action;
 
-       if (cls->common.protocol == htons(ETH_P_ALL) &&
-           flow_offload_has_one_action(&cls->rule->action) &&
-           cls->rule->action.entries[0].id == FLOW_ACTION_MIRRED)
-               err = dsa_user_add_cls_matchall_mirred(dev, cls, ingress);
-       else if (flow_offload_has_one_action(&cls->rule->action) &&
-                cls->rule->action.entries[0].id == FLOW_ACTION_POLICE)
-               err = dsa_user_add_cls_matchall_police(dev, cls, ingress);
+       if (!flow_offload_has_one_action(action))
+               return -EOPNOTSUPP;
 
-       return err;
+       switch (action->entries[0].id) {
+       case FLOW_ACTION_MIRRED:
+               return dsa_user_add_cls_matchall_mirred(dev, cls, ingress);
+       case FLOW_ACTION_POLICE:
+               return dsa_user_add_cls_matchall_police(dev, cls, ingress);
+       default:
+               break;
+       }
+
+       return -EOPNOTSUPP;
 }
 
 static void dsa_user_del_cls_matchall(struct net_device *dev,