imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
	 Bartosz Golaszewski <brgl@bgdev.pl>,
	Shawn Guo <shawnguo@kernel.org>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>, Ray Jui <rjui@broadcom.com>,
	 Scott Branden <sbranden@broadcom.com>,
	 Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	 Yang Shen <shenyang39@huawei.com>,
	 Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 04/12] gpio: mlxbf2: use dev_err_probe() where applicable
Date: Tue, 26 Aug 2025 11:35:05 +0200	[thread overview]
Message-ID: <20250826-gpio-mmio-gpio-conv-part2-v1-4-f67603e4b27e@linaro.org> (raw)
In-Reply-To: <20250826-gpio-mmio-gpio-conv-part2-v1-0-f67603e4b27e@linaro.org>

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Simplify error handling and shrink the code by using dev_err_probe()
consistently across the driver.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-mlxbf2.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c
index 390f2e74a9d8193f924ee50f4a8f2d7bc6ae2168..bc4bba8b567c2605a77d4f9d4d7d916e8b096569 100644
--- a/drivers/gpio/gpio-mlxbf2.c
+++ b/drivers/gpio/gpio-mlxbf2.c
@@ -369,10 +369,8 @@ mlxbf2_gpio_probe(struct platform_device *pdev)
 		return PTR_ERR(gs->gpio_io);
 
 	ret = mlxbf2_gpio_get_lock_res(pdev);
-	if (ret) {
-		dev_err(dev, "Failed to get yu_arm_gpio_lock resource\n");
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to get yu_arm_gpio_lock resource\n");
 
 	if (device_property_read_u32(dev, "npins", &npins))
 		npins = MLXBF2_GPIO_MAX_PINS_PER_BLOCK;
@@ -387,10 +385,8 @@ mlxbf2_gpio_probe(struct platform_device *pdev)
 			NULL,
 			0);
 
-	if (ret) {
-		dev_err(dev, "bgpio_init failed\n");
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "bgpio_init failed\n");
 
 	gc->direction_input = mlxbf2_gpio_direction_input;
 	gc->direction_output = mlxbf2_gpio_direction_output;
@@ -414,19 +410,15 @@ mlxbf2_gpio_probe(struct platform_device *pdev)
 		 */
 		ret = devm_request_irq(dev, irq, mlxbf2_gpio_irq_handler,
 				       IRQF_SHARED, name, gs);
-		if (ret) {
-			dev_err(dev, "failed to request IRQ");
-			return ret;
-		}
+		if (ret)
+			return dev_err_probe(dev, ret, "failed to request IRQ");
 	}
 
 	platform_set_drvdata(pdev, gs);
 
 	ret = devm_gpiochip_add_data(dev, &gs->gc, gs);
-	if (ret) {
-		dev_err(dev, "Failed adding memory mapped gpiochip\n");
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed adding memory mapped gpiochip\n");
 
 	return 0;
 }

-- 
2.48.1


  parent reply	other threads:[~2025-08-26  9:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26  9:35 [PATCH 00/12] gpio: replace legacy bgpio_init() with its modernized alternative - part 2 Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 01/12] gpio: xgene-sb: use new generic GPIO chip API Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 02/12] gpio: mxs: order includes alphabetically Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 03/12] gpio: mxs: use new generic GPIO chip API Bartosz Golaszewski
2025-08-26  9:35 ` Bartosz Golaszewski [this message]
2025-08-26  9:35 ` [PATCH 05/12] gpio: mlxbf2: " Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 06/12] gpio: xgs-iproc: " Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 07/12] gpio: ftgpio010: order includes alphabetically Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 08/12] gpio: ftgpio010: use new generic GPIO chip API Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 09/12] gpio: realtek-otto: " Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 10/12] gpio: hisi: " Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 11/12] gpio: vf610: " Bartosz Golaszewski
2025-08-26  9:35 ` [PATCH 12/12] gpio: visconti: " Bartosz Golaszewski
2025-08-28 20:38 ` [PATCH 00/12] gpio: replace legacy bgpio_init() with its modernized alternative - part 2 Linus Walleij
2025-09-03  7:38 ` 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=20250826-gpio-mmio-gpio-conv-part2-v1-4-f67603e4b27e@linaro.org \
    --to=brgl@bgdev.pl \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --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=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=rjui@broadcom.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sbranden@broadcom.com \
    --cc=shawnguo@kernel.org \
    --cc=shenyang39@huawei.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).