Skip to content

Commit ef49ec1

Browse files
ArvindYadavCsgregkh
authored andcommitted
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>
1 parent 9de9a44 commit ef49ec1

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/base/soc.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
150150

151151
out3:
152152
ida_simple_remove(&soc_ida, soc_dev->soc_dev_num);
153+
put_device(&soc_dev->dev);
154+
soc_dev = NULL;
153155
out2:
154156
kfree(soc_dev);
155157
out1:

0 commit comments

Comments
 (0)