Move the reference count increasing of flow table to be in
create_flow_rule, it will increase the reference count for each rule
creation and not for each flow.
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
                goto free;
        }
 
+       ft_prio->refcount++;
        handler->prio = ft_prio;
 
        ft_prio->flow_table = ft;
                                               flow_attr, dst);
                if (IS_ERR(handler_dst)) {
                        mlx5_del_flow_rule(handler->rule);
+                       ft_prio->refcount--;
                        kfree(handler);
                        handler = handler_dst;
                } else {
                                                 dst);
                if (IS_ERR(handler_ucast)) {
                        mlx5_del_flow_rule(handler->rule);
+                       ft_prio->refcount--;
                        kfree(handler);
                        handler = handler_ucast;
                } else {
                goto destroy_ft;
        }
 
-       ft_prio->refcount++;
        mutex_unlock(&dev->flow_db.lock);
        kfree(dst);