Re: [PATCH net-next] net: mvpp2: Don't use dynamic allocs for local variables

From: Antoine Tenart
Date: Tue Mar 20 2018 - 13:56:51 EST


Hi Maxime,

On Tue, Mar 20, 2018 at 04:34:08PM +0100, Maxime Chevallier wrote:
> @@ -2416,36 +2393,36 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1,
> }
>
> if (tid >= tid_aux) {
> - ret = -ERANGE;
> - goto free_pe;
> + return -ERANGE;
> }

You can remove the brackets here.

> @@ -3833,39 +3804,39 @@ static int mvpp2_prs_mac_da_accept(struct mvpp2_port *port, const u8 *da,

[...]

> /* Invalidate the entry if no ports are left enabled */
> - pmap = mvpp2_prs_tcam_port_map_get(pe);
> + pmap = mvpp2_prs_tcam_port_map_get(&pe);
> if (pmap == 0) {
> if (add) {
> - kfree(pe);
> return -EINVAL;
> }

And here.

Thanks!
Antoine

--
Antoine Ténart, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com