[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc71d8cf6e9bb4bb8cd9ae5050100081891d9345.1744452787.git.dan.carpenter@linaro.org>
Date: Sat, 12 Apr 2025 13:15:08 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Koichiro Den <koichiro.den@...onical.com>
Cc: Geert Uytterhoeven <geert+renesas@...der.be>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/5] gpio: aggregator: Fix gpio_aggregator_line_alloc()
checking
The gpio_aggregator_line_alloc() function returns error pointers, but
the callers check for NULL. Update the error checking in the callers.
Fixes: 83c8e3df642f ("gpio: aggregator: expose aggregator created via legacy sysfs to configfs")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
drivers/gpio/gpio-aggregator.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c
index b4c9e373a6ec..e1b2efc0df99 100644
--- a/drivers/gpio/gpio-aggregator.c
+++ b/drivers/gpio/gpio-aggregator.c
@@ -984,8 +984,8 @@ gpio_aggregator_device_make_group(struct config_group *group, const char *name)
return ERR_PTR(-EINVAL);
line = gpio_aggregator_line_alloc(aggr, idx, NULL, -1);
- if (!line)
- return ERR_PTR(-ENOMEM);
+ if (IS_ERR(line))
+ return ERR_CAST(line);
config_group_init_type_name(&line->group, name, &gpio_aggregator_line_type);
@@ -1074,8 +1074,8 @@ static int gpio_aggregator_parse(struct gpio_aggregator *aggr)
/* Named GPIO line */
scnprintf(name, sizeof(name), "line%u", n);
line = gpio_aggregator_line_alloc(aggr, n, key, -1);
- if (!line) {
- error = -ENOMEM;
+ if (IS_ERR(line)) {
+ error = PTR_ERR(line);
goto err;
}
config_group_init_type_name(&line->group, name,
@@ -1105,8 +1105,8 @@ static int gpio_aggregator_parse(struct gpio_aggregator *aggr)
for_each_set_bit(i, bitmap, AGGREGATOR_MAX_GPIOS) {
scnprintf(name, sizeof(name), "line%u", n);
line = gpio_aggregator_line_alloc(aggr, n, key, i);
- if (!line) {
- error = -ENOMEM;
+ if (IS_ERR(line)) {
+ error = PTR_ERR(line);
goto err;
}
config_group_init_type_name(&line->group, name,
--
2.47.2
Powered by blists - more mailing lists