Skip to content

Commit dd4f503

Browse files
committed
Merge tag 'pinctrl-v6.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: "Mostly error path fixes, but one pretty serious interrupt problem in the Ocelot driver as well: - Fix two error paths and a missing semicolon in the Intel driver - Add a missing ACPI ID for the Intel Panther Lake - Check return value of devm_kasprintf() in the Apple and STM32 drivers - Add a missing mutex_destroy() in the aw9523 driver - Fix a double free in cv1800_pctrl_dt_node_to_map() in the Sophgo driver - Fix a double free in ma35_pinctrl_dt_node_to_map_func() in the Nuvoton driver - Fix a bug in the Ocelot interrupt handler making the system hang" * tag 'pinctrl-v6.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: ocelot: fix system hang on level based interrupts pinctrl: nuvoton: fix a double free in ma35_pinctrl_dt_node_to_map_func() pinctrl: sophgo: fix double free in cv1800_pctrl_dt_node_to_map() pinctrl: intel: platform: Add Panther Lake to the list of supported pinctrl: aw9523: add missing mutex_destroy pinctrl: stm32: check devm_kasprintf() returned value pinctrl: apple: check devm_kasprintf() returned value pinctrl: intel: platform: use semicolon instead of comma in ncommunities assignment pinctrl: intel: platform: fix error path in device_for_each_child_node()
2 parents c552282 + 93b8ddc commit dd4f503

File tree

8 files changed

+23
-13
lines changed

8 files changed

+23
-13
lines changed

drivers/pinctrl/intel/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ config PINCTRL_INTEL_PLATFORM
4646
of Intel PCH pins and using them as GPIOs. Currently the following
4747
Intel SoCs / platforms require this to be functional:
4848
- Lunar Lake
49+
- Panther Lake
4950

5051
config PINCTRL_ALDERLAKE
5152
tristate "Intel Alder Lake pinctrl and GPIO driver"

drivers/pinctrl/intel/pinctrl-intel-platform.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev,
9090
struct intel_community *community,
9191
struct intel_platform_pins *pins)
9292
{
93-
struct fwnode_handle *child;
9493
struct intel_padgroup *gpps;
9594
unsigned int group;
9695
size_t ngpps;
@@ -131,7 +130,7 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev,
131130
return -ENOMEM;
132131

133132
group = 0;
134-
device_for_each_child_node(dev, child) {
133+
device_for_each_child_node_scoped(dev, child) {
135134
struct intel_padgroup *gpp = &gpps[group];
136135

137136
gpp->reg_num = group;
@@ -159,7 +158,7 @@ static int intel_platform_pinctrl_prepare_soc_data(struct device *dev,
159158
int ret;
160159

161160
/* Version 1.0 of the specification assumes only a single community per device node */
162-
ncommunities = 1,
161+
ncommunities = 1;
163162
communities = devm_kcalloc(dev, ncommunities, sizeof(*communities), GFP_KERNEL);
164163
if (!communities)
165164
return -ENOMEM;

drivers/pinctrl/nuvoton/pinctrl-ma35.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev,
218218
}
219219

220220
map_num += grp->npins;
221-
new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), GFP_KERNEL);
221+
new_map = kcalloc(map_num, sizeof(*new_map), GFP_KERNEL);
222222
if (!new_map)
223223
return -ENOMEM;
224224

drivers/pinctrl/pinctrl-apple-gpio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,9 @@ static int apple_gpio_pinctrl_probe(struct platform_device *pdev)
474474
for (i = 0; i < npins; i++) {
475475
pins[i].number = i;
476476
pins[i].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "PIN%u", i);
477+
if (!pins[i].name)
478+
return -ENOMEM;
479+
477480
pins[i].drv_data = pctl;
478481
pin_names[i] = pins[i].name;
479482
pin_nums[i] = i;

drivers/pinctrl/pinctrl-aw9523.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,8 +987,10 @@ static int aw9523_probe(struct i2c_client *client)
987987
lockdep_set_subclass(&awi->i2c_lock, i2c_adapter_depth(client->adapter));
988988

989989
pdesc = devm_kzalloc(dev, sizeof(*pdesc), GFP_KERNEL);
990-
if (!pdesc)
991-
return -ENOMEM;
990+
if (!pdesc) {
991+
ret = -ENOMEM;
992+
goto err_disable_vregs;
993+
}
992994

993995
ret = aw9523_hw_init(awi);
994996
if (ret)

drivers/pinctrl/pinctrl-ocelot.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,21 +1955,21 @@ static void ocelot_irq_handler(struct irq_desc *desc)
19551955
unsigned int reg = 0, irq, i;
19561956
unsigned long irqs;
19571957

1958+
chained_irq_enter(parent_chip, desc);
1959+
19581960
for (i = 0; i < info->stride; i++) {
19591961
regmap_read(info->map, id_reg + 4 * i, &reg);
19601962
if (!reg)
19611963
continue;
19621964

1963-
chained_irq_enter(parent_chip, desc);
1964-
19651965
irqs = reg;
19661966

19671967
for_each_set_bit(irq, &irqs,
19681968
min(32U, info->desc->npins - 32 * i))
19691969
generic_handle_domain_irq(chip->irq.domain, irq + 32 * i);
1970-
1971-
chained_irq_exit(parent_chip, desc);
19721970
}
1971+
1972+
chained_irq_exit(parent_chip, desc);
19731973
}
19741974

19751975
static int ocelot_gpiochip_register(struct platform_device *pdev,

drivers/pinctrl/sophgo/pinctrl-cv18xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static int cv1800_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
221221
if (!grpnames)
222222
return -ENOMEM;
223223

224-
map = devm_kcalloc(dev, ngroups * 2, sizeof(*map), GFP_KERNEL);
224+
map = kcalloc(ngroups * 2, sizeof(*map), GFP_KERNEL);
225225
if (!map)
226226
return -ENOMEM;
227227

drivers/pinctrl/stm32/pinctrl-stm32.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,10 +1374,15 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
13741374

13751375
for (i = 0; i < npins; i++) {
13761376
stm32_pin = stm32_pctrl_get_desc_pin_from_gpio(pctl, bank, i);
1377-
if (stm32_pin && stm32_pin->pin.name)
1377+
if (stm32_pin && stm32_pin->pin.name) {
13781378
names[i] = devm_kasprintf(dev, GFP_KERNEL, "%s", stm32_pin->pin.name);
1379-
else
1379+
if (!names[i]) {
1380+
err = -ENOMEM;
1381+
goto err_clk;
1382+
}
1383+
} else {
13801384
names[i] = NULL;
1385+
}
13811386
}
13821387

13831388
bank->gpio_chip.names = (const char * const *)names;

0 commit comments

Comments
 (0)