Skip to contentSkip to conversation

pinctrl/pinctrl-core: cleanup pinctrl_register

PATCH Applied Devendra Naga 2 participants 2 messages Jun 16, 2012 – Jun 18, 2012 Pin control

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

This is _completely_ untested change and also non build tested (since i dont have a cross compiler (arch?) to build with and it was not selectable in make allyesconfig)

i didn't removed the one and only ret assignment
at pinctrl_register_pins because it became ugly while seeing at it.

 drivers/pinctrl/core.c |   17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/pinctrl/core.c +6 -11
index 0cc053a..50d9c28 100644
@@ -1395,9 +1395,9 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
 	struct pinctrl_dev *pctldev;
 	int ret;
 
-	if (pctldesc == NULL)
+	if (!pctldesc)
 		return NULL;
-	if (pctldesc->name == NULL)
+	if (!pctldesc->name)
 		return NULL;
 
 	pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
@@ -1415,23 +1415,20 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
 	pctldev->dev = dev;
 
 	/* check core ops for sanity */
-	ret = pinctrl_check_ops(pctldev);
-	if (ret) {
+	if (pinctrl_check_ops(pctldev)) {
 		dev_err(dev, "pinctrl ops lacks necessary functions\n");
 		goto out_err;
 	}
 
 	/* If we're implementing pinmuxing, check the ops for sanity */
 	if (pctldesc->pmxops) {
-		ret = pinmux_check_ops(pctldev);
-		if (ret)
+		if (pinmux_check_ops(pctldev))
 			goto out_err;
 	}
 
 	/* If we're implementing pinconfig, check the ops for sanity */
 	if (pctldesc->confops) {
-		ret = pinconf_check_ops(pctldev);
-		if (ret)
+		if (pinconf_check_ops(pctldev))
 			goto out_err;
 	}
 
@@ -1457,11 +1454,9 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
 		if (IS_ERR(s)) {
 			dev_dbg(dev, "failed to lookup the default state\n");
 		} else {
-			ret = pinctrl_select_state_locked(pctldev->p, s);
-			if (ret) {
+			if (pinctrl_select_state_locked(pctldev->p, s))
 				dev_err(dev,
 					"failed to select default state\n");
-			}
 		}
 	}
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 5 lines · Devendra Naga

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.

Applied, thanks!
Linus Walleij