return 0;
}
-static int gpiochip_alloc_valid_mask(struct gpio_chip *gc)
-{
- if (!(gpiochip_count_reserved_ranges(gc) || gc->init_valid_mask))
- return 0;
-
- gc->valid_mask = gpiochip_allocate_mask(gc);
- if (!gc->valid_mask)
- return -ENOMEM;
-
- return 0;
-}
-
static int gpiochip_apply_reserved_ranges(struct gpio_chip *gc)
{
struct device *dev = &gc->gpiodev->dev;
{
int ret;
+ if (!(gpiochip_count_reserved_ranges(gc) || gc->init_valid_mask))
+ return 0;
+
+ gc->valid_mask = gpiochip_allocate_mask(gc);
+ if (!gc->valid_mask)
+ return -ENOMEM;
+
ret = gpiochip_apply_reserved_ranges(gc);
if (ret)
return ret;
if (ret)
goto err_remove_from_list;
- ret = gpiochip_alloc_valid_mask(gc);
+ ret = gpiochip_init_valid_mask(gc);
if (ret)
goto err_remove_from_list;
if (ret)
goto err_free_gpiochip_mask;
- ret = gpiochip_init_valid_mask(gc);
- if (ret)
- goto err_remove_of_chip;
-
for (i = 0; i < gc->ngpio; i++) {
struct gpio_desc *desc = &gdev->descs[i];