summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2018-03-11 00:55:48 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-15 09:37:03 -0400
commitef49ec1dc35112b17f7e928aa08fcab60240bf1d (patch)
treeb735a02ac7d941b7bb4b1403a500c6d0f89e5dc1 /drivers/base
parent9de9a449482677a75f1edd2049268a7efc40fc96 (diff)
base: soc: use put_device() instead of kfree()
Never directly free @dev after calling device_register(), even if it returned an error! Always use put_device() to give up the reference initialized. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/soc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index 4e80f48ad5d6..10b280f30217 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -150,6 +150,8 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
150 150
151out3: 151out3:
152 ida_simple_remove(&soc_ida, soc_dev->soc_dev_num); 152 ida_simple_remove(&soc_ida, soc_dev->soc_dev_num);
153 put_device(&soc_dev->dev);
154 soc_dev = NULL;
153out2: 155out2:
154 kfree(soc_dev); 156 kfree(soc_dev);
155out1: 157out1: