[PATCH 2/3] PWM: core: remove needless error checking for device parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The PWM device is specifically created for purposes of the PWM
framework. There should thus be no naming clashes and -ENOMEM
is not a fatal error there either, because the PWM C API is
still usable without the device parameters.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/pwm/core.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 69724e1a5c26..4dd18d9446aa 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -94,7 +94,6 @@ static int set_enable(struct param_d *p, void *priv)
 int pwmchip_add(struct pwm_chip *chip)
 {
 	struct pwm_device *pwm;
-	struct param_d *p;
 	int ret;
 
 	if (!chip->devname)
@@ -117,24 +116,18 @@ int pwmchip_add(struct pwm_chip *chip)
 
 	list_add_tail(&pwm->node, &pwm_list);
 
-	p = dev_add_param_uint32(&pwm->dev, "duty_ns", apply_params,
-			NULL, &pwm->params.duty_cycle, "%u", pwm);
-	if (IS_ERR(p))
-		return PTR_ERR(p);
+	dev_add_param_uint32(&pwm->dev, "duty_ns", apply_params,
+			     NULL, &pwm->params.duty_cycle, "%u", pwm);
 
-	p = dev_add_param_uint32(&pwm->dev, "period_ns", apply_params,
-			NULL, &pwm->params.period, "%u", pwm);
-	if (IS_ERR(p))
-		return PTR_ERR(p);
+	dev_add_param_uint32(&pwm->dev, "period_ns", apply_params,
+			     NULL, &pwm->params.period, "%u", pwm);
 
-	p = dev_add_param_bool(&pwm->dev, "enable", set_enable,
-			NULL, &pwm->params.enabled, pwm);
-	if (IS_ERR(p))
-		return PTR_ERR(p);
+	dev_add_param_bool(&pwm->dev, "enable", set_enable,
+			   NULL, &pwm->params.enabled, pwm);
 
-	p = dev_add_param_bool(&pwm->dev, "inverted", apply_params,
-			       NULL, &pwm->params.polarity, pwm);
-	return PTR_ERR_OR_ZERO(p);
+	dev_add_param_bool(&pwm->dev, "inverted", apply_params,
+			   NULL, &pwm->params.polarity, pwm);
+	return 0;
 }
 EXPORT_SYMBOL_GPL(pwmchip_add);
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux