[PATCH v1 1/1] gpiolib: shared: Don't define variable in the middle of the code
From: Andy Shevchenko
Date: Tue Oct 13 2026 - 05:48:27 EST
While the C11 allows us to define variables in the code, we do not
do this style (see more at [1]). Move the declaration to the top of
the function.
Link: https://lore.kernel.org/lkml/58fd478f408a34b578ee8d949c5c4b4da4d4f41d.camel@xxxxxxxxxxxxxxxxxxxxx/ [1]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
drivers/gpio/gpiolib-shared.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpiolib-shared.c b/drivers/gpio/gpiolib-shared.c
index 5f9623e40b0f..40c08f1ae5f0 100644
--- a/drivers/gpio/gpiolib-shared.c
+++ b/drivers/gpio/gpiolib-shared.c
@@ -196,6 +196,7 @@ static int gpio_shared_of_traverse(struct device_node *curr)
for (i = 0; i < count; i++) {
struct device_node *np __free(device_node) = NULL;
char *con_id __free(kfree) = NULL;
+ struct fwnode_handle *curr_fwnode;
ret = of_parse_phandle_with_args(curr, prop->name,
"#gpio-cells", i,
@@ -261,8 +262,7 @@ static int gpio_shared_of_traverse(struct device_node *curr)
con_id[con_id_len - suffix_len] = '\0';
}
- struct fwnode_handle *curr_fwnode =
- fwnode_handle_get(of_fwnode_handle(curr));
+ curr_fwnode = fwnode_handle_get(of_fwnode_handle(curr));
ref = gpio_shared_make_ref(curr_fwnode, con_id, args.args[1]);
if (!ref) {
fwnode_handle_put(curr_fwnode);
--
2.50.1