mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
pinctrl/pinctrl-core: cleanup pinctrl_register
lots of places the ret is used just for non zero cases with out that also we can check the status of the function calls. Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
7e1dfe5319
commit
da9aecb02d
@ -1395,9 +1395,9 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
|
|||||||
struct pinctrl_dev *pctldev;
|
struct pinctrl_dev *pctldev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (pctldesc == NULL)
|
if (!pctldesc)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (pctldesc->name == NULL)
|
if (!pctldesc->name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
|
pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
|
||||||
@ -1415,23 +1415,20 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
|
|||||||
pctldev->dev = dev;
|
pctldev->dev = dev;
|
||||||
|
|
||||||
/* check core ops for sanity */
|
/* check core ops for sanity */
|
||||||
ret = pinctrl_check_ops(pctldev);
|
if (pinctrl_check_ops(pctldev)) {
|
||||||
if (ret) {
|
|
||||||
dev_err(dev, "pinctrl ops lacks necessary functions\n");
|
dev_err(dev, "pinctrl ops lacks necessary functions\n");
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're implementing pinmuxing, check the ops for sanity */
|
/* If we're implementing pinmuxing, check the ops for sanity */
|
||||||
if (pctldesc->pmxops) {
|
if (pctldesc->pmxops) {
|
||||||
ret = pinmux_check_ops(pctldev);
|
if (pinmux_check_ops(pctldev))
|
||||||
if (ret)
|
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're implementing pinconfig, check the ops for sanity */
|
/* If we're implementing pinconfig, check the ops for sanity */
|
||||||
if (pctldesc->confops) {
|
if (pctldesc->confops) {
|
||||||
ret = pinconf_check_ops(pctldev);
|
if (pinconf_check_ops(pctldev))
|
||||||
if (ret)
|
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1457,11 +1454,9 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
|
|||||||
if (IS_ERR(s)) {
|
if (IS_ERR(s)) {
|
||||||
dev_dbg(dev, "failed to lookup the default state\n");
|
dev_dbg(dev, "failed to lookup the default state\n");
|
||||||
} else {
|
} else {
|
||||||
ret = pinctrl_select_state_locked(pctldev->p, s);
|
if (pinctrl_select_state_locked(pctldev->p, s))
|
||||||
if (ret) {
|
|
||||||
dev_err(dev,
|
dev_err(dev,
|
||||||
"failed to select default state\n");
|
"failed to select default state\n");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user