From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Jianqun Xu <jay.xu@rock-chips.com>,
Linus Walleij <linus.walleij@linaro.org>,
Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org
Cc: Bamvor Jian Zhang <bamv2005@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Gregory Clement <gregory.clement@bootlin.com>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Heiko Stuebner <heiko@sntech.de>,
Patrice Chotard <patrice.chotard@foss.st.com>,
Michal Simek <michal.simek@xilinx.com>,
Andy Shevchenko <andy@kernel.org>
Subject: [PATCH v1 16/19] pinctrl: st: Convert to use dev_err_probe()
Date: Fri, 5 Nov 2021 14:42:39 +0200 [thread overview]
Message-ID: <20211105124242.27288-16-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20211105124242.27288-1-andriy.shevchenko@linux.intel.com>
It's fine to call dev_err_probe() in ->probe() when error code is known.
Convert the driver to use dev_err_probe().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-st.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index bccde0b8f012..9cb0da88b098 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -1255,10 +1255,8 @@ static int st_pctl_parse_functions(struct device_node *np,
func = &info->functions[index];
func->name = np->name;
func->ngroups = of_get_child_count(np);
- if (func->ngroups == 0) {
- dev_err(dev, "No groups defined\n");
- return -EINVAL;
- }
+ if (func->ngroups == 0)
+ return dev_err_probe(dev, -EINVAL, "No groups defined\n");
func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL);
if (!func->groups)
return -ENOMEM;
@@ -1555,10 +1553,8 @@ static int st_gpiolib_register_bank(struct st_pinctrl *info,
skip_irq:
err = gpiochip_add_data(&bank->gpio_chip, bank);
- if (err) {
- dev_err(dev, "Failed to add gpiochip(%d)!\n", bank_num);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err, "Failed to add gpiochip(%d)!\n", bank_num);
dev_info(dev, "%s bank added.\n", range->name);
return 0;
@@ -1585,10 +1581,8 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
int irq = 0;
st_pctl_dt_child_count(info, np);
- if (!info->nbanks) {
- dev_err(dev, "you need at least one gpio bank\n");
- return -EINVAL;
- }
+ if (!info->nbanks)
+ return dev_err_probe(dev, -EINVAL, "you need at least one gpio bank\n");
dev_info(dev, "nbanks = %d\n", info->nbanks);
dev_info(dev, "nfunctions = %d\n", info->nfunctions);
@@ -1604,10 +1598,8 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
return -ENOMEM;
info->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
- if (IS_ERR(info->regmap)) {
- dev_err(dev, "No syscfg phandle specified\n");
- return PTR_ERR(info->regmap);
- }
+ if (IS_ERR(info->regmap))
+ return dev_err_probe(dev, PTR_ERR(info->regmap), "No syscfg phandle specified\n");
info->data = of_match_node(st_pctl_of_match, np)->data;
irq = platform_get_irq(pdev, 0);
@@ -1695,10 +1687,8 @@ static int st_pctl_probe(struct platform_device *pdev)
pctl_desc->name = dev_name(dev);
info->pctl = devm_pinctrl_register(dev, pctl_desc, info);
- if (IS_ERR(info->pctl)) {
- dev_err(dev, "Failed pinctrl registration\n");
- return PTR_ERR(info->pctl);
- }
+ if (IS_ERR(info->pctl))
+ return dev_err_probe(dev, PTR_ERR(info->pctl), "Failed pinctrl registration\n");
for (i = 0; i < info->nbanks; i++)
pinctrl_add_gpio_range(info->pctl, &info->banks[i].range);
--
2.33.0
next prev parent reply other threads:[~2021-11-05 12:43 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 12:42 [PATCH v1 01/19] lib/string_helpers: Introduce kasprintf_strarray() Andy Shevchenko
2021-11-05 12:42 ` [PATCH v1 02/19] lib/string_helpers: Introduce managed variant of kasprintf_strarray() Andy Shevchenko
2021-11-05 12:42 ` [PATCH v1 03/19] pinctrl/rockchip: Drop wrong kernel doc annotation Andy Shevchenko
2021-11-06 16:32 ` Heiko Stübner
2021-11-05 12:42 ` [PATCH v1 04/19] pinctrl/rockchip: Use temporary variable for struct device Andy Shevchenko
2021-11-08 12:46 ` Heiko Stübner
2021-11-05 12:42 ` [PATCH v1 05/19] pinctrl/rockchip: Make use of the devm_platform_get_and_ioremap_resource() Andy Shevchenko
2021-11-08 12:48 ` Heiko Stübner
2021-11-05 12:42 ` [PATCH v1 06/19] pinctrl/rockchip: Convert to use dev_err_probe() Andy Shevchenko
2021-11-08 12:49 ` Heiko Stübner
2021-11-05 12:42 ` [PATCH v1 07/19] pinctrl/rockchip: Switch to use devm_kasprintf_strarray() Andy Shevchenko
2021-11-08 12:51 ` Heiko Stübner
2021-11-05 12:42 ` [PATCH v1 08/19] pinctrl: armada-37xx: Fix function name in the kernel doc Andy Shevchenko
2021-11-08 10:37 ` Gregory CLEMENT
2021-11-05 12:42 ` [PATCH v1 09/19] pinctrl: armada-37xx: Use temporary variable for struct device Andy Shevchenko
2021-11-08 10:49 ` Gregory CLEMENT
2021-11-05 12:42 ` [PATCH v1 10/19] pinctrl: armada-37xx: Make use of the devm_platform_ioremap_resource() Andy Shevchenko
2021-11-08 10:56 ` Gregory CLEMENT
2021-11-05 12:42 ` [PATCH v1 11/19] pinctrl: armada-37xx: Convert to use dev_err_probe() Andy Shevchenko
2021-11-08 10:59 ` Gregory CLEMENT
2021-11-05 12:42 ` [PATCH v1 12/19] pinctrl: armada-37xx: Switch to use devm_kasprintf_strarray() Andy Shevchenko
2021-11-08 11:09 ` Gregory CLEMENT
2021-11-05 12:42 ` [PATCH v1 13/19] pinctrl: st: Drop wrong kernel doc annotations Andy Shevchenko
2021-11-09 11:32 ` Linus Walleij
2021-11-09 12:04 ` Andy Shevchenko
2021-11-05 12:42 ` [PATCH v1 14/19] pinctrl: st: Use temporary variable for struct device Andy Shevchenko
2021-11-06 7:50 ` Joe Perches
[not found] ` <CAHp75Ve0Bv9VsWFFZxL9wYk=Z_Mm7nat-vf7g8HHTiROi7EY=Q@mail.gmail.com>
2021-11-06 8:28 ` Joe Perches
2021-11-08 9:26 ` Andy Shevchenko
2021-11-09 11:55 ` Linus Walleij
2021-11-09 12:07 ` Andy Shevchenko
2021-11-09 12:09 ` Andy Shevchenko
2021-11-05 12:42 ` [PATCH v1 15/19] pinctrl: st: Make use of the devm_platform_ioremap_resource_byname() Andy Shevchenko
2021-11-09 11:33 ` Linus Walleij
2021-11-05 12:42 ` Andy Shevchenko [this message]
2021-11-09 11:34 ` [PATCH v1 16/19] pinctrl: st: Convert to use dev_err_probe() Linus Walleij
2021-11-05 12:42 ` [PATCH v1 17/19] pinctrl: st: Switch to use devm_kasprintf_strarray() Andy Shevchenko
2021-11-09 11:34 ` Linus Walleij
2021-11-05 12:42 ` [PATCH v1 18/19] pinctrl: zynqmp: Unify pin naming Andy Shevchenko
2021-11-09 11:34 ` Linus Walleij
2021-11-05 12:42 ` [PATCH v1 19/19] gpio: mockup: Switch to use kasprintf_strarray() Andy Shevchenko
2021-11-09 11:35 ` Linus Walleij
2021-11-16 9:12 ` Bartosz Golaszewski
2021-11-06 7:34 ` [PATCH v1 01/19] lib/string_helpers: Introduce kasprintf_strarray() Joe Perches
2021-11-09 11:42 ` Linus Walleij
2021-11-15 11:23 ` Andy Shevchenko
2021-11-18 16:56 ` Andy Shevchenko
2021-11-18 20:30 ` Bartosz Golaszewski
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=20211105124242.27288-16-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=andrew@lunn.ch \
--cc=andy@kernel.org \
--cc=bamv2005@gmail.com \
--cc=brgl@bgdev.pl \
--cc=gregory.clement@bootlin.com \
--cc=heiko@sntech.de \
--cc=jay.xu@rock-chips.com \
--cc=lakshmi.sai.krishna.potthuri@xilinx.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=michal.simek@xilinx.com \
--cc=patrice.chotard@foss.st.com \
--cc=sebastian.hesselbarth@gmail.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;
as well as URLs for NNTP newsgroup(s).