Skip to content

Commit

Permalink
sparc: vio: 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 <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Arvind Yadav authored and David S. Miller committed Apr 30, 2018
1 parent d3c68d0 commit 00ad691
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/sparc/kernel/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
if (err) {
printk(KERN_ERR "VIO: Could not register device %s, err=%d\n",
dev_name(&vdev->dev), err);
kfree(vdev);
put_device(&vdev->dev);
return NULL;
}
if (vdev->dp)
Expand Down

0 comments on commit 00ad691

Please sign in to comment.