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>
This commit is contained in:
Thierry Reding 2015-10-05 14:38:32 +02:00
Родитель f6649f7ad8
Коммит 655a03554c
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -738,8 +738,10 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
}
}
if (!chosen)
if (!chosen) {
pwm = ERR_PTR(-ENODEV);
goto out;
}
chip = pwmchip_find_by_name(chosen->provider);
if (!chip)