[<prev] [next>] [day] [month] [year] [list]
Message-Id: <6d62570e4914054536ac7f62ee385c2887e8f093.1520331702.git.arvind.yadav.cs@gmail.com>
Date: Tue, 6 Mar 2018 15:54:06 +0530
From: Arvind Yadav <arvind.yadav.cs@...il.com>
To: zbr@...emap.net, gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] w1: use put_device() if device_register() fail
If device_register() returned an error! Always use put_device()
to give up the reference initialized in device_register().
Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
---
drivers/w1/w1.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 0c2a5a8..80a778b 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -706,6 +706,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
dev_err(&sl->dev,
"Device registration [%s] failed. err=%d\n",
dev_name(&sl->dev), err);
+ put_device(&sl->dev);
return err;
}
w1_family_notify(BUS_NOTIFY_ADD_DEVICE, sl);
--
1.9.1
Powered by blists - more mailing lists