Skip to content

Commit

Permalink
net: ieee802154: mcr20a: do not leak resources on error path
Browse files Browse the repository at this point in the history
We already allocated the device and platform  data at this
point. Instead of simply return from the probe function we
need to cleanup the resources first.

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Acked-by: Xue Liu <liuxuenetmail@gmail.com>
  • Loading branch information
Stefan Schmidt committed Apr 23, 2018
1 parent f9e628a commit 7e0ffee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ieee802154/mcr20a.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,8 +1309,10 @@ mcr20a_probe(struct spi_device *spi)
/* init buf */
lp->buf = devm_kzalloc(&spi->dev, SPI_COMMAND_BUFFER, GFP_KERNEL);

if (!lp->buf)
return -ENOMEM;
if (!lp->buf) {
ret = -ENOMEM;
goto free_dev;
}

mcr20a_setup_tx_spi_messages(lp);
mcr20a_setup_rx_spi_messages(lp);
Expand Down

0 comments on commit 7e0ffee

Please sign in to comment.