summaryrefslogtreecommitdiff
path: root/drivers/w1
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2018-03-06 15:54:06 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-14 14:58:50 +0100
commit0ec4eb71b4956548a9c652f6c26232995916008c (patch)
tree08ec4a6661b9890d8e030ee03a67e057cc197f6d /drivers/w1
parentaeef9c09740691e33aceeaa5f5b8a4457a4eab97 (diff)
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@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/w1.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 0c2a5a8327bd..80a778b02f28 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);