mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
w1: fix redundant counter decrement in w1_attach_slave_device()
In w1_attach_slave_device(), if __w1_attach_slave_device() fails,
put_device() -> w1_slave_release() is called to do the cleanup job.
In w1_slave_release(), sl->family->refcnt and sl->master->slave_count
have already been decremented. There is no need to decrement twice
in w1_attach_slave_device().
Fixes: 2c927c0c73 ("w1: Fix slave count on 1-Wire bus (resend)")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Link: https://patch.msgid.link/20251218111414.564403-1-lihaoxiang@isrc.iscas.ac.cn
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
This commit is contained in:
committed by
Krzysztof Kozlowski
parent
761fcf46a1
commit
cc8f92e41e
@@ -758,8 +758,6 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
|
||||
if (err < 0) {
|
||||
dev_err(&dev->dev, "%s: Attaching %s failed.\n", __func__,
|
||||
sl->name);
|
||||
dev->slave_count--;
|
||||
w1_family_put(sl->family);
|
||||
atomic_dec(&sl->master->refcnt);
|
||||
kfree(sl);
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user