From: Arvind Yadav Date: Wed, 25 Apr 2018 14:56:14 +0000 (+0530) Subject: sparc: vio: use put_device() instead of kfree() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ea5ffcd46716fcda3da98313cffcf1ae5dcbb2c2;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git sparc: vio: use put_device() instead of kfree() [ Upstream commit 00ad691ab140b54ab9f5de5e74cb994f552e8124 ] 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- 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, 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)