Netdev List
 help / color / mirror / Atom feed
* [PATCH] ieee802154: ca8210: prevent memory leak
@ 2019-09-17 22:47 Navid Emamdoost
  2019-09-19 14:56 ` Stefan Schmidt
  2019-09-27 20:01 ` Stefan Schmidt
  0 siblings, 2 replies; 3+ messages in thread
From: Navid Emamdoost @ 2019-09-17 22:47 UTC (permalink / raw)
  Cc: emamd001, smccaman, kjlu, Navid Emamdoost, Harry Morris,
	Alexander Aring, Stefan Schmidt, David S. Miller, linux-wpan,
	netdev, linux-kernel

In ca8210_probe the allocated pdata needs to be assigned to
spi_device->dev.platform_data before calling ca8210_get_platform_data. 
Othrwise when ca8210_get_platform_data fails pdata cannot be released.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/net/ieee802154/ca8210.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index b188fce3f641..229d70a897ca 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -3152,12 +3152,12 @@ static int ca8210_probe(struct spi_device *spi_device)
 		goto error;
 	}
 
+	priv->spi->dev.platform_data = pdata;
 	ret = ca8210_get_platform_data(priv->spi, pdata);
 	if (ret) {
 		dev_crit(&spi_device->dev, "ca8210_get_platform_data failed\n");
 		goto error;
 	}
-	priv->spi->dev.platform_data = pdata;
 
 	ret = ca8210_dev_com_init(priv);
 	if (ret) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-27 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-17 22:47 [PATCH] ieee802154: ca8210: prevent memory leak Navid Emamdoost
2019-09-19 14:56 ` Stefan Schmidt
2019-09-27 20:01 ` Stefan Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox