Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 752caf9a authored by Markus Elfring's avatar Markus Elfring Committed by Linus Walleij
Browse files

pinctrl: max77620: Use common error handling code in max77620_pinconf_set()



* Add a jump target so that a specific error message is stored only once
  at the end of this function implementation.

* Replace two calls of the function "dev_err" by goto statements.

* Adjust two condition checks.

This issue was detected by using the Coccinelle software.

Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 60ad481f
Loading
Loading
Loading
Loading
+11 −10
Original line number Original line Diff line number Diff line
@@ -420,11 +420,9 @@ static int max77620_pinconf_set(struct pinctrl_dev *pctldev,
						 MAX77620_REG_GPIO0 + pin,
						 MAX77620_REG_GPIO0 + pin,
						 MAX77620_CNFG_GPIO_DRV_MASK,
						 MAX77620_CNFG_GPIO_DRV_MASK,
						 val);
						 val);
			if (ret < 0) {
			if (ret)
				dev_err(dev, "Reg 0x%02x update failed %d\n",
				goto report_update_failure;
					MAX77620_REG_GPIO0 + pin, ret);

				return ret;
			}
			mpci->pin_info[pin].drv_type = val ?
			mpci->pin_info[pin].drv_type = val ?
				MAX77620_PIN_PP_DRV : MAX77620_PIN_OD_DRV;
				MAX77620_PIN_PP_DRV : MAX77620_PIN_OD_DRV;
			break;
			break;
@@ -435,11 +433,9 @@ static int max77620_pinconf_set(struct pinctrl_dev *pctldev,
						 MAX77620_REG_GPIO0 + pin,
						 MAX77620_REG_GPIO0 + pin,
						 MAX77620_CNFG_GPIO_DRV_MASK,
						 MAX77620_CNFG_GPIO_DRV_MASK,
						 val);
						 val);
			if (ret < 0) {
			if (ret)
				dev_err(dev, "Reg 0x%02x update failed %d\n",
				goto report_update_failure;
					MAX77620_REG_GPIO0 + pin, ret);

				return ret;
			}
			mpci->pin_info[pin].drv_type = val ?
			mpci->pin_info[pin].drv_type = val ?
				MAX77620_PIN_PP_DRV : MAX77620_PIN_OD_DRV;
				MAX77620_PIN_PP_DRV : MAX77620_PIN_OD_DRV;
			break;
			break;
@@ -536,6 +532,11 @@ static int max77620_pinconf_set(struct pinctrl_dev *pctldev,
	}
	}


	return 0;
	return 0;

report_update_failure:
	dev_err(dev, "Reg 0x%02x update failed %d\n",
		MAX77620_REG_GPIO0 + pin, ret);
	return ret;
}
}


static const struct pinconf_ops max77620_pinconf_ops = {
static const struct pinconf_ops max77620_pinconf_ops = {