From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Patrick Rudolph <patrick.rudolph@9elements.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH v1 6/6] pinctrl: cy8c95x0: remove unneeded goto labels
Date: Sun, 10 Nov 2024 22:59:46 +0200 [thread overview]
Message-ID: <20241110210040.18918-7-andy.shevchenko@gmail.com> (raw)
In-Reply-To: <20241110210040.18918-1-andy.shevchenko@gmail.com>
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 <andy.shevchenko@gmail.com>
---
drivers/pinctrl/pinctrl-cy8c95x0.c | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c
index 8c611abd4745..0d6c2027d4c1 100644
--- a/drivers/pinctrl/pinctrl-cy8c95x0.c
+++ b/drivers/pinctrl/pinctrl-cy8c95x0.c
@@ -746,14 +746,12 @@ static int cy8c95x0_gpio_get_direction(struct gpio_chip *gc, unsigned int off)
ret = cy8c95x0_regmap_read(chip, CY8C95X0_DIRECTION, port, ®_val);
if (ret < 0)
- goto out;
+ return ret;
if (reg_val & bit)
return GPIO_LINE_DIRECTION_IN;
return GPIO_LINE_DIRECTION_OUT;
-out:
- return ret;
}
static int cy8c95x0_gpio_get_pincfg(struct cy8c95x0_pinctrl *chip,
@@ -815,8 +813,7 @@ static int cy8c95x0_gpio_get_pincfg(struct cy8c95x0_pinctrl *chip,
case PIN_CONFIG_SLEEP_HARDWARE_STATE:
case PIN_CONFIG_SLEW_RATE:
default:
- ret = -ENOTSUPP;
- goto out;
+ return -ENOTSUPP;
}
/*
* Writing 1 to one of the drive mode registers will automatically
@@ -824,7 +821,7 @@ static int cy8c95x0_gpio_get_pincfg(struct cy8c95x0_pinctrl *chip,
*/
ret = cy8c95x0_regmap_read(chip, reg, port, ®_val);
if (ret < 0)
- goto out;
+ return ret;
if (reg_val & bit)
arg = 1;
@@ -832,8 +829,7 @@ static int cy8c95x0_gpio_get_pincfg(struct cy8c95x0_pinctrl *chip,
arg = !arg;
*config = pinconf_to_config_packed(param, (u16)arg);
-out:
- return ret;
+ return 0;
}
static int cy8c95x0_gpio_set_pincfg(struct cy8c95x0_pinctrl *chip,
@@ -845,7 +841,6 @@ static int cy8c95x0_gpio_set_pincfg(struct cy8c95x0_pinctrl *chip,
unsigned long param = pinconf_to_config_param(config);
unsigned long arg = pinconf_to_config_argument(config);
unsigned int reg;
- int ret;
switch (param) {
case PIN_CONFIG_BIAS_PULL_UP:
@@ -876,22 +871,17 @@ static int cy8c95x0_gpio_set_pincfg(struct cy8c95x0_pinctrl *chip,
reg = CY8C95X0_PWMSEL;
break;
case PIN_CONFIG_OUTPUT_ENABLE:
- ret = cy8c95x0_pinmux_direction(chip, off, !arg);
- goto out;
+ return cy8c95x0_pinmux_direction(chip, off, !arg);
case PIN_CONFIG_INPUT_ENABLE:
- ret = cy8c95x0_pinmux_direction(chip, off, arg);
- goto out;
+ return cy8c95x0_pinmux_direction(chip, off, arg);
default:
- ret = -ENOTSUPP;
- goto out;
+ return -ENOTSUPP;
}
/*
* Writing 1 to one of the drive mode registers will automatically
* clear conflicting set bits in the other drive mode registers.
*/
- ret = cy8c95x0_regmap_write_bits(chip, reg, port, bit, bit);
-out:
- return ret;
+ return cy8c95x0_regmap_write_bits(chip, reg, port, bit, bit);
}
static int cy8c95x0_gpio_get_multiple(struct gpio_chip *gc,
--
2.47.0
next prev parent reply other threads:[~2024-11-10 21:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-10 20:59 [PATCH v1 0/6] pinctrl: cy8c95x0: A portion of cleanups Andy Shevchenko
2024-11-10 20:59 ` [PATCH v1 1/6] pinctrl: cy8c95x0: Use 2-argument strscpy() Andy Shevchenko
2024-11-10 20:59 ` [PATCH v1 2/6] pinctrl: cy8c95x0: switch to using devm_regulator_get_enable() Andy Shevchenko
2024-11-10 20:59 ` [PATCH v1 3/6] pinctrl: cy8c95x0: use flexible sleeping in reset function Andy Shevchenko
2024-11-10 20:59 ` [PATCH v1 4/6] pinctrl: cy8c95x0: Use temporary variable for struct device Andy Shevchenko
2024-11-10 20:59 ` [PATCH v1 5/6] pinctrl: cy8c95x0: embed iterator to the for-loop Andy Shevchenko
2024-11-10 20:59 ` Andy Shevchenko [this message]
2024-11-13 13:18 ` [PATCH v1 0/6] pinctrl: cy8c95x0: A portion of cleanups Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241110210040.18918-7-andy.shevchenko@gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patrick.rudolph@9elements.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®