summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/marvell
diff options
context:
space:
mode:
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>2017-02-19 12:19:57 +0300
committerDavid S. Miller <davem@davemloft.net>2017-02-20 18:33:19 +0300
commit177c8d1c96eb9851210313922a12ae8b0b63d8c0 (patch)
tree03cfbfd65d0ab6d088efc9a3510d13a121005b9d /drivers/net/ethernet/marvell
parent3608b13ccc51d06e499dfe12b27f134de1286e28 (diff)
downloadlinux-177c8d1c96eb9851210313922a12ae8b0b63d8c0.tar.xz
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: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell')
-rw-r--r--drivers/net/ethernet/marvell/mvpp2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index c2fd7c36f927..c48632048f71 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -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) {