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

Eric Bénard eric at eukrea.com
Sun Apr 29 15:02:29 EDT 2012


* this patch fix error handling in pwmchip_add

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

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;
 
-- 
1.7.7.6




More information about the linux-arm-kernel mailing list