diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-02-27 13:54:20 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-02-27 13:54:20 -0500 |
| commit | 3ebd3da699731929af8ef879001c8c38d1817211 (patch) | |
| tree | b037364e95fe0e70410aee8dfa86467a87b3e819 | |
| parent | 8d7531825c0dc24f3f300c07fb1a2a3a00b9e89c (diff) | |
| parent | 0b7d25c347900e2550398e29e25caf0fefe3cab2 (diff) | |
Merge tag 'pwm/for-3.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm
Pull pwm fix from Thierry Reding:
"Just a single trivial patch to plug a memory leak in an error path"
* tag 'pwm/for-3.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
pwm: lp3943: Fix potential memory leak during request
| -rw-r--r-- | drivers/pwm/pwm-lp3943.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c index 8a843a04c224..a40b9c34e9ff 100644 --- a/drivers/pwm/pwm-lp3943.c +++ b/drivers/pwm/pwm-lp3943.c | |||
| @@ -52,8 +52,10 @@ lp3943_pwm_request_map(struct lp3943_pwm *lp3943_pwm, int hwpwm) | |||
| 52 | offset = pwm_map->output[i]; | 52 | offset = pwm_map->output[i]; |
| 53 | 53 | ||
| 54 | /* Return an error if the pin is already assigned */ | 54 | /* Return an error if the pin is already assigned */ |
| 55 | if (test_and_set_bit(offset, &lp3943->pin_used)) | 55 | if (test_and_set_bit(offset, &lp3943->pin_used)) { |
| 56 | kfree(pwm_map); | ||
| 56 | return ERR_PTR(-EBUSY); | 57 | return ERR_PTR(-EBUSY); |
| 58 | } | ||
| 57 | } | 59 | } |
| 58 | 60 | ||
| 59 | return pwm_map; | 61 | return pwm_map; |
