diff options
author | Stefan Schmidt <stefan@osg.samsung.com> | 2018-04-12 14:28:49 +0200 |
---|---|---|
committer | Stefan Schmidt <stefan@osg.samsung.com> | 2018-04-23 20:56:23 +0200 |
commit | 7e0ffee1b2e7d26cc2147be0d9d5186823e923f3 (patch) | |
tree | 67b80ad93acea2f525353b6e7fa0945a5e98950f /drivers/net/ieee802154 | |
parent | f9e628a6645ed4f42a15dfa3c5af45a916a228e4 (diff) | |
download | blackbird-op-linux-7e0ffee1b2e7d26cc2147be0d9d5186823e923f3.tar.gz blackbird-op-linux-7e0ffee1b2e7d26cc2147be0d9d5186823e923f3.zip |
net: ieee802154: mcr20a: do not leak resources on error path
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>
Diffstat (limited to 'drivers/net/ieee802154')
-rw-r--r-- | drivers/net/ieee802154/mcr20a.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c index 944470d69ba9..de0d7f28a181 100644 --- a/drivers/net/ieee802154/mcr20a.c +++ b/drivers/net/ieee802154/mcr20a.c @@ -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); |