Skip to content

Commit

Permalink
w1: use put_device() if device_register() fail
Browse files Browse the repository at this point in the history
If device_register() returned an error! Always use put_device()
to give up the reference initialized in device_register().

Signed-off-by: Arvind Yadav <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
ArvindYadavCs authored and gregkh committed Mar 14, 2018
1 parent aeef9c0 commit 0ec4eb7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/w1/w1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0ec4eb7

Please sign in to comment.