Skip to content

Commit c0842db

Browse files
committed
Merge tag 'gpio-fixes-for-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: - fix initial value handling for output-only pins in gpio-tps68470 - fix two resource leaks in gpio-mvebu * tag 'gpio-fixes-for-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: mvebu: fix irq domain leak gpio: mvebu: Make use of devm_pwmchip_add gpio: tps68470: Make tps68470_gpio_output() always set the initial value
2 parents d192f53 + 644ee70 commit c0842db

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

drivers/gpio/gpio-mvebu.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
874874

875875
spin_lock_init(&mvpwm->lock);
876876

877-
return pwmchip_add(&mvpwm->chip);
877+
return devm_pwmchip_add(dev, &mvpwm->chip);
878878
}
879879

880880
#ifdef CONFIG_DEBUG_FS
@@ -1112,6 +1112,13 @@ static int mvebu_gpio_probe_syscon(struct platform_device *pdev,
11121112
return 0;
11131113
}
11141114

1115+
static void mvebu_gpio_remove_irq_domain(void *data)
1116+
{
1117+
struct irq_domain *domain = data;
1118+
1119+
irq_domain_remove(domain);
1120+
}
1121+
11151122
static int mvebu_gpio_probe(struct platform_device *pdev)
11161123
{
11171124
struct mvebu_gpio_chip *mvchip;
@@ -1243,17 +1250,21 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
12431250
if (!mvchip->domain) {
12441251
dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
12451252
mvchip->chip.label);
1246-
err = -ENODEV;
1247-
goto err_pwm;
1253+
return -ENODEV;
12481254
}
12491255

1256+
err = devm_add_action_or_reset(&pdev->dev, mvebu_gpio_remove_irq_domain,
1257+
mvchip->domain);
1258+
if (err)
1259+
return err;
1260+
12501261
err = irq_alloc_domain_generic_chips(
12511262
mvchip->domain, ngpios, 2, np->name, handle_level_irq,
12521263
IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_LEVEL, 0, 0);
12531264
if (err) {
12541265
dev_err(&pdev->dev, "couldn't allocate irq chips %s (DT).\n",
12551266
mvchip->chip.label);
1256-
goto err_domain;
1267+
return err;
12571268
}
12581269

12591270
/*
@@ -1293,13 +1304,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
12931304
}
12941305

12951306
return 0;
1296-
1297-
err_domain:
1298-
irq_domain_remove(mvchip->domain);
1299-
err_pwm:
1300-
pwmchip_remove(&mvchip->mvpwm->chip);
1301-
1302-
return err;
13031307
}
13041308

13051309
static struct platform_driver mvebu_gpio_driver = {

drivers/gpio/gpio-tps68470.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ static int tps68470_gpio_output(struct gpio_chip *gc, unsigned int offset,
9191
struct tps68470_gpio_data *tps68470_gpio = gpiochip_get_data(gc);
9292
struct regmap *regmap = tps68470_gpio->tps68470_regmap;
9393

94+
/* Set the initial value */
95+
tps68470_gpio_set(gc, offset, value);
96+
9497
/* rest are always outputs */
9598
if (offset >= TPS68470_N_REGULAR_GPIO)
9699
return 0;
97100

98-
/* Set the initial value */
99-
tps68470_gpio_set(gc, offset, value);
100-
101101
return regmap_update_bits(regmap, TPS68470_GPIO_CTL_REG_A(offset),
102102
TPS68470_GPIO_MODE_MASK,
103103
TPS68470_GPIO_MODE_OUT_CMOS);

0 commit comments

Comments
 (0)