Skip to content

Commit

Permalink
pwm: Fix device reference leak
Browse files Browse the repository at this point in the history
Make sure to drop the reference to the parent device taken by
class_find_device() after "unexporting" any children when deregistering
a PWM chip.

Fixes: 0733424 ("pwm: Unexport children before chip removal")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Johan Hovold authored and Thierry Reding committed Nov 29, 2016
1 parent c699995 commit 0e1614a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/pwm/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ void pwmchip_sysfs_unexport_children(struct pwm_chip *chip)
if (test_bit(PWMF_EXPORTED, &pwm->flags))
pwm_unexport_child(parent, pwm);
}

put_device(parent);
}

static int __init pwm_sysfs_init(void)
Expand Down

0 comments on commit 0e1614a

Please sign in to comment.