[2/3] pwm-core: fix error handling in pwmchip_add

Submitted by Eric Benard on April 29, 2012, 7:02 p.m.

Details

Message ID 1335726150-22600-2-git-send-email-eric@eukrea.com
State New
Headers show

Commit Message

Eric Benard April 29, 2012, 7:02 p.m.
* this patch fix error handling in pwmchip_add

Signed-off-by: Eric BĂ©nard <eric@eukrea.com>
---
 drivers/pwm/core.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 47e6262..b3a99a6 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -216,8 +216,10 @@  int pwmchip_add(struct pwm_chip *chip)
 		goto out;
 
 	chip->pwms = kzalloc(chip->npwm * sizeof(*pwm), GFP_KERNEL);
-	if (!chip->pwms)
-		return -ENOMEM;
+	if (!chip->pwms) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	chip->base = ret;