Skip to content

Commit

Permalink
base: soc: use put_device() instead of kfree()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
ArvindYadavCs authored and gregkh committed Mar 15, 2018
1 parent 9de9a44 commit ef49ec1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/base/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr

out3:
ida_simple_remove(&soc_ida, soc_dev->soc_dev_num);
put_device(&soc_dev->dev);
soc_dev = NULL;
out2:
kfree(soc_dev);
out1:
Expand Down

0 comments on commit ef49ec1

Please sign in to comment.