diff options
author | Thierry Reding <thierry.reding@gmail.com> | 2015-10-05 08:38:32 -0400 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2015-11-10 07:06:42 -0500 |
commit | 655a03554cbdf73e8114367441f10858baac59bf (patch) | |
tree | 7e43fd930cc726ad92f0a331493e3f8521603918 | |
parent | f6649f7ad8efbaf82679ab0ccdfe837a65bd58d8 (diff) |
pwm: Return -ENODEV if no PWM lookup match is found
When looking up a PWM using the lookup table, assume that all entries
will have been added already, so failure to find a match means that no
corresponding entry has been registered.
This fixes an issue where -EPROBE_DEFER would be returned if the PWM
lookup table is empty. After this fix, -EPROBE_DEFER is reserved for
situations where no provider has yet registered for a matching entry.
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
-rw-r--r-- | drivers/pwm/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index b8f6c309c160..d24ca5f281b4 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c | |||
@@ -738,8 +738,10 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) | |||
738 | } | 738 | } |
739 | } | 739 | } |
740 | 740 | ||
741 | if (!chosen) | 741 | if (!chosen) { |
742 | pwm = ERR_PTR(-ENODEV); | ||
742 | goto out; | 743 | goto out; |
744 | } | ||
743 | 745 | ||
744 | chip = pwmchip_find_by_name(chosen->provider); | 746 | chip = pwmchip_find_by_name(chosen->provider); |
745 | if (!chip) | 747 | if (!chip) |