diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2018-04-25 10:56:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-30 16:09:34 -0400 |
commit | 00ad691ab140b54ab9f5de5e74cb994f552e8124 (patch) | |
tree | 576e21cceb8802d26a4d3a4e2a116d0440112c6c | |
parent | d3c68d0b4183ddfa05577348a231dd117e6563df (diff) |
sparc: vio: 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: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/kernel/vio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c index 1a0fa10cb6b7..32bae68e34c1 100644 --- a/arch/sparc/kernel/vio.c +++ b/arch/sparc/kernel/vio.c | |||
@@ -403,7 +403,7 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, | |||
403 | if (err) { | 403 | if (err) { |
404 | printk(KERN_ERR "VIO: Could not register device %s, err=%d\n", | 404 | printk(KERN_ERR "VIO: Could not register device %s, err=%d\n", |
405 | dev_name(&vdev->dev), err); | 405 | dev_name(&vdev->dev), err); |
406 | kfree(vdev); | 406 | put_device(&vdev->dev); |
407 | return NULL; | 407 | return NULL; |
408 | } | 408 | } |
409 | if (vdev->dp) | 409 | if (vdev->dp) |