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

login
register
mail settings
Submitter Eric Benard
Date April 29, 2012, 7:02 p.m.
Message ID <1335726150-22600-2-git-send-email-eric@eukrea.com>
Download mbox | patch
Permalink /patch/155762/
State New
Headers show

Comments

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

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;