Skip to content

Commit 581d240

Browse files
andy-shevlinusw
authored andcommitted
pinctrl: cy8c95x0: remove unneeded goto labels
In some cases the code uses goto labels to just return an error code. Replace those with direct return:s and drop unneeded goto labels. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent ab899a0 commit 581d240

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

drivers/pinctrl/pinctrl-cy8c95x0.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -746,14 +746,12 @@ static int cy8c95x0_gpio_get_direction(struct gpio_chip *gc, unsigned int off)
746746

747747
ret = cy8c95x0_regmap_read(chip, CY8C95X0_DIRECTION, port, &reg_val);
748748
if (ret < 0)
749-
goto out;
749+
return ret;
750750

751751
if (reg_val & bit)
752752
return GPIO_LINE_DIRECTION_IN;
753753

754754
return GPIO_LINE_DIRECTION_OUT;
755-
out:
756-
return ret;
757755
}
758756

759757
static int cy8c95x0_gpio_get_pincfg(struct cy8c95x0_pinctrl *chip,
@@ -815,25 +813,23 @@ static int cy8c95x0_gpio_get_pincfg(struct cy8c95x0_pinctrl *chip,
815813
case PIN_CONFIG_SLEEP_HARDWARE_STATE:
816814
case PIN_CONFIG_SLEW_RATE:
817815
default:
818-
ret = -ENOTSUPP;
819-
goto out;
816+
return -ENOTSUPP;
820817
}
821818
/*
822819
* Writing 1 to one of the drive mode registers will automatically
823820
* clear conflicting set bits in the other drive mode registers.
824821
*/
825822
ret = cy8c95x0_regmap_read(chip, reg, port, &reg_val);
826823
if (ret < 0)
827-
goto out;
824+
return ret;
828825

829826
if (reg_val & bit)
830827
arg = 1;
831828
if (param == PIN_CONFIG_OUTPUT_ENABLE)
832829
arg = !arg;
833830

834831
*config = pinconf_to_config_packed(param, (u16)arg);
835-
out:
836-
return ret;
832+
return 0;
837833
}
838834

839835
static int cy8c95x0_gpio_set_pincfg(struct cy8c95x0_pinctrl *chip,
@@ -845,7 +841,6 @@ static int cy8c95x0_gpio_set_pincfg(struct cy8c95x0_pinctrl *chip,
845841
unsigned long param = pinconf_to_config_param(config);
846842
unsigned long arg = pinconf_to_config_argument(config);
847843
unsigned int reg;
848-
int ret;
849844

850845
switch (param) {
851846
case PIN_CONFIG_BIAS_PULL_UP:
@@ -876,22 +871,17 @@ static int cy8c95x0_gpio_set_pincfg(struct cy8c95x0_pinctrl *chip,
876871
reg = CY8C95X0_PWMSEL;
877872
break;
878873
case PIN_CONFIG_OUTPUT_ENABLE:
879-
ret = cy8c95x0_pinmux_direction(chip, off, !arg);
880-
goto out;
874+
return cy8c95x0_pinmux_direction(chip, off, !arg);
881875
case PIN_CONFIG_INPUT_ENABLE:
882-
ret = cy8c95x0_pinmux_direction(chip, off, arg);
883-
goto out;
876+
return cy8c95x0_pinmux_direction(chip, off, arg);
884877
default:
885-
ret = -ENOTSUPP;
886-
goto out;
878+
return -ENOTSUPP;
887879
}
888880
/*
889881
* Writing 1 to one of the drive mode registers will automatically
890882
* clear conflicting set bits in the other drive mode registers.
891883
*/
892-
ret = cy8c95x0_regmap_write_bits(chip, reg, port, bit, bit);
893-
out:
894-
return ret;
884+
return cy8c95x0_regmap_write_bits(chip, reg, port, bit, bit);
895885
}
896886

897887
static int cy8c95x0_gpio_get_multiple(struct gpio_chip *gc,

0 commit comments

Comments
 (0)