Re: [PATCH v3] nfp: abm: fix memory leak in nfp_abm_u32_knode_replace

From: Jakub Kicinski
Date: Fri Sep 27 2019 - 17:43:04 EST


On Fri, 27 Sep 2019 14:12:42 +0200, Markus Elfring wrote:
> > Updated other gotos to have correct errno returned, too.
>
> How do you think about to add a jump target here?
>
>
> > +++ b/drivers/net/ethernet/netronome/nfp/abm/cls.c
> > @@ -176,8 +176,10 @@ nfp_abm_u32_knode_replace(struct nfp_abm_link *alink,
> > u8 mask, val;
> > int err;
> >
> > - if (!nfp_abm_u32_check_knode(alink->abm, knode, proto, extack))
> > + if (!nfp_abm_u32_check_knode(alink->abm, knode, proto, extack)) {
> > + err = -EOPNOTSUPP;
> > goto err_delete;
> > + }
> >
> > tos_off = proto == htons(ETH_P_IP) ? 16 : 20;
>
> - goto err_delete;
> + goto e_opnotsupp;
>
>
> > @@ -221,7 +227,7 @@ nfp_abm_u32_knode_replace(struct nfp_abm_link *alink,
> >
>
> +e_opnotsupp:
> + err = -EOPNOTSUPP;
>
> > err_delete:
> > nfp_abm_u32_knode_delete(alink, knode);
> > - return -EOPNOTSUPP;
> > + return err;
> > }
> >
> > static int nfp_abm_setup_tc_block_cb(enum tc_setup_type type,
>
>
> Can such a change variant be a bit nicer?

Definitely not.

Looks good as is, thanks Navid!