Subject: [PATCH 45/53] net/iucv: Free memory obtained by kzalloc

From: Arvind Yadav <[email-masked]>
Date: Tue, 13 Mar 2018 16:50:06 +0100

[ Upstream commit fa6a91e9b907231d2e38ea5ed89c537b3525df3d ]

Free memory by calling put_device(), if afiucv_iucv_init is not
successful.

Signed-off-by: Arvind Yadav <[email-masked]>
Reviewed-by: Cornelia Huck <[email-masked]>
Signed-off-by: Ursula Braun <[email-masked]>
Signed-off-by: Julian Wiedmann <[email-masked]>
Signed-off-by: David S. Miller <[email-masked]>
---
 net/iucv/af_iucv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 148533169b1d..ca98276c2709 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -2433,9 +2433,11 @@ static int afiucv_iucv_init(void)
 	af_iucv_dev->driver = &af_iucv_driver;
 	err = device_register(af_iucv_dev);
 	if (err)
-		goto out_driver;
+		goto out_iucv_dev;
 	return 0;
 
+out_iucv_dev:
+	put_device(af_iucv_dev);
 out_driver:
 	driver_unregister(&af_iucv_driver);
 out_iucv:
-- 
2.14.3