* [PATCH 1/3] pwm-imx: set chip.dev to prevent probe failure
@ 2012-04-29 19:02 Eric Bénard
2012-04-29 19:02 ` [PATCH 2/3] pwm-core: fix error handling in pwmchip_add Eric Bénard
2012-04-29 19:02 ` [PATCH 3/3] pwm: fix pwmchip_add return code test Eric Bénard
0 siblings, 2 replies; 3+ messages in thread
From: Eric Bénard @ 2012-04-29 19:02 UTC (permalink / raw)
To: linux-arm-kernel
else pwmchip_add fails
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
drivers/pwm/pwm-imx.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index ef9c51b..d69275f 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -175,6 +175,7 @@ static int __devinit imx_pwm_probe(struct platform_device *pdev)
imx->chip.ops = &imx_pwm_ops;
imx->chip.base = -1;
imx->chip.npwm = 1;
+ imx->chip.dev = &pdev->dev;
imx->clk_enabled = 0;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] pwm-core: fix error handling in pwmchip_add
2012-04-29 19:02 [PATCH 1/3] pwm-imx: set chip.dev to prevent probe failure Eric Bénard
@ 2012-04-29 19:02 ` Eric Bénard
2012-04-29 19:02 ` [PATCH 3/3] pwm: fix pwmchip_add return code test Eric Bénard
1 sibling, 0 replies; 3+ messages in thread
From: Eric Bénard @ 2012-04-29 19:02 UTC (permalink / raw)
To: linux-arm-kernel
* 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(-)
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] pwm: fix pwmchip_add return code test
2012-04-29 19:02 [PATCH 1/3] pwm-imx: set chip.dev to prevent probe failure Eric Bénard
2012-04-29 19:02 ` [PATCH 2/3] pwm-core: fix error handling in pwmchip_add Eric Bénard
@ 2012-04-29 19:02 ` Eric Bénard
1 sibling, 0 replies; 3+ messages in thread
From: Eric Bénard @ 2012-04-29 19:02 UTC (permalink / raw)
To: linux-arm-kernel
* this should fail only if the value is negative.
* else after a pwm is allocated using alloc_pwms, ret contains the number
of the pwm and is returned by pwmchip_add so the calling driver
(pwm-imx in my case) fails with the following log :
mxc_pwm: probe of mxc_pwm.1 failed with error 1
mxc_pwm: probe of mxc_pwm.2 failed with error 2
mxc_pwm: probe of mxc_pwm.3 failed with error 3
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
drivers/pwm/pwm-imx.c | 2 +-
drivers/pwm/pwm-samsung.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index d69275f..24384cb 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -201,7 +201,7 @@ static int __devinit imx_pwm_probe(struct platform_device *pdev)
}
ret = pwmchip_add(&imx->chip);
- if (ret)
+ if (ret < 0)
goto err_iounmap;
platform_set_drvdata(pdev, imx);
diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index 631edf0..c40c37e 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -253,7 +253,7 @@ static int s3c_pwm_probe(struct platform_device *pdev)
local_irq_restore(flags);
ret = pwmchip_add(&s3c->chip);
- if (ret) {
+ if (ret < 0) {
dev_err(dev, "failed to register pwm\n");
goto err_clk_tdiv;
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-29 19:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-29 19:02 [PATCH 1/3] pwm-imx: set chip.dev to prevent probe failure Eric Bénard
2012-04-29 19:02 ` [PATCH 2/3] pwm-core: fix error handling in pwmchip_add Eric Bénard
2012-04-29 19:02 ` [PATCH 3/3] pwm: fix pwmchip_add return code test Eric Bénard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).