mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
pinctrl: fix pinmux_check_ops error checking
Do not use get_functions_count before checking. Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
d1e90e9e74
commit
a1d31f71e6
1 changed files with 5 additions and 3 deletions
|
@ -33,11 +33,12 @@
|
||||||
int pinmux_check_ops(struct pinctrl_dev *pctldev)
|
int pinmux_check_ops(struct pinctrl_dev *pctldev)
|
||||||
{
|
{
|
||||||
const struct pinmux_ops *ops = pctldev->desc->pmxops;
|
const struct pinmux_ops *ops = pctldev->desc->pmxops;
|
||||||
unsigned nfuncs = ops->get_functions_count(pctldev);
|
unsigned nfuncs;
|
||||||
unsigned selector = 0;
|
unsigned selector = 0;
|
||||||
|
|
||||||
/* Check that we implement required operations */
|
/* Check that we implement required operations */
|
||||||
if (!ops->get_functions_count ||
|
if (!ops ||
|
||||||
|
!ops->get_functions_count ||
|
||||||
!ops->get_function_name ||
|
!ops->get_function_name ||
|
||||||
!ops->get_function_groups ||
|
!ops->get_function_groups ||
|
||||||
!ops->enable ||
|
!ops->enable ||
|
||||||
|
@ -45,11 +46,12 @@ int pinmux_check_ops(struct pinctrl_dev *pctldev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Check that all functions registered have names */
|
/* Check that all functions registered have names */
|
||||||
|
nfuncs = ops->get_functions_count(pctldev);
|
||||||
while (selector < nfuncs) {
|
while (selector < nfuncs) {
|
||||||
const char *fname = ops->get_function_name(pctldev,
|
const char *fname = ops->get_function_name(pctldev,
|
||||||
selector);
|
selector);
|
||||||
if (!fname) {
|
if (!fname) {
|
||||||
pr_err("pinmux ops has no name for function%u\n",
|
dev_err(pctldev->dev, "pinmux ops has no name for function%u\n",
|
||||||
selector);
|
selector);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue