Commit 177c8d1c authored by Christophe Jaillet's avatar Christophe Jaillet Committed by David S. Miller
Browse files

net: mvpp2: Fix a memory leak in error handling path



if 'devm_kzalloc()' fails, we should release resources allocated so far,
just as done a few lines below.

Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3608b13c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -5971,8 +5971,10 @@ static int mvpp2_port_init(struct mvpp2_port *port)
		struct mvpp2_tx_queue *txq;

		txq = devm_kzalloc(dev, sizeof(*txq), GFP_KERNEL);
		if (!txq)
			return -ENOMEM;
		if (!txq) {
			err = -ENOMEM;
			goto err_free_percpu;
		}

		txq->pcpu = alloc_percpu(struct mvpp2_txq_pcpu);
		if (!txq->pcpu) {