All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm: Fix of_pwm_get() for consistent return values
@ 2015-11-29 13:17 Alban Bedel
  2016-01-04  8:10 ` Thierry Reding
  0 siblings, 1 reply; 3+ messages in thread
From: Alban Bedel @ 2015-11-29 13:17 UTC (permalink / raw)
  To: linux-pwm; +Cc: Alban Bedel, Thierry Reding, linux-kernel

When of_pwm_get() is called without connection ID it returns
-ENOENT when the 'pwms' property doesn't exists or is an empty entry.
However when a connection ID is given and the 'pwm-names' property
doesn't exists or doesn't contains the requested name it returns
-ENODATA or -EINVAL.

To get a consistent return value with both code paths we must return
-ENOENT when of_property_match_string() fails.

Signed-off-by: Alban Bedel <albeu@free.fr>
---
 drivers/pwm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index d24ca5f..3b4dcb6 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -578,7 +578,7 @@ struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id)
 	if (con_id) {
 		index = of_property_match_string(np, "pwm-names", con_id);
 		if (index < 0)
-			return ERR_PTR(index);
+			return ERR_PTR(-ENOENT);
 	}
 
 	err = of_parse_phandle_with_args(np, "pwms", "#pwm-cells", index,
-- 
2.0.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-04 13:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-29 13:17 [PATCH] pwm: Fix of_pwm_get() for consistent return values Alban Bedel
2016-01-04  8:10 ` Thierry Reding
2016-01-04 13:51   ` Alban

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.