Skip to content

Commit da9aecb

Browse files
Devendra NagaLinus Walleij
authored andcommitted
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>
1 parent 7e1dfe5 commit da9aecb

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

‎drivers/pinctrl/core.c‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,9 +1395,9 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
13951395
struct pinctrl_dev *pctldev;
13961396
int ret;
13971397

1398-
if (pctldesc == NULL)
1398+
if (!pctldesc)
13991399
return NULL;
1400-
if (pctldesc->name == NULL)
1400+
if (!pctldesc->name)
14011401
return NULL;
14021402

14031403
pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
@@ -1415,23 +1415,20 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
14151415
pctldev->dev = dev;
14161416

14171417
/* check core ops for sanity */
1418-
ret = pinctrl_check_ops(pctldev);
1419-
if (ret) {
1418+
if (pinctrl_check_ops(pctldev)) {
14201419
dev_err(dev, "pinctrl ops lacks necessary functions\n");
14211420
goto out_err;
14221421
}
14231422

14241423
/* If we're implementing pinmuxing, check the ops for sanity */
14251424
if (pctldesc->pmxops) {
1426-
ret = pinmux_check_ops(pctldev);
1427-
if (ret)
1425+
if (pinmux_check_ops(pctldev))
14281426
goto out_err;
14291427
}
14301428

14311429
/* If we're implementing pinconfig, check the ops for sanity */
14321430
if (pctldesc->confops) {
1433-
ret = pinconf_check_ops(pctldev);
1434-
if (ret)
1431+
if (pinconf_check_ops(pctldev))
14351432
goto out_err;
14361433
}
14371434

@@ -1457,11 +1454,9 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
14571454
if (IS_ERR(s)) {
14581455
dev_dbg(dev, "failed to lookup the default state\n");
14591456
} else {
1460-
ret = pinctrl_select_state_locked(pctldev->p, s);
1461-
if (ret) {
1457+
if (pinctrl_select_state_locked(pctldev->p, s))
14621458
dev_err(dev,
14631459
"failed to select default state\n");
1464-
}
14651460
}
14661461
}
14671462

0 commit comments

Comments
 (0)