Commit dd4f5037 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents c5522822 93b8ddc5
...@@ -46,6 +46,7 @@ config PINCTRL_INTEL_PLATFORM ...@@ -46,6 +46,7 @@ config PINCTRL_INTEL_PLATFORM
of Intel PCH pins and using them as GPIOs. Currently the following of Intel PCH pins and using them as GPIOs. Currently the following
Intel SoCs / platforms require this to be functional: Intel SoCs / platforms require this to be functional:
- Lunar Lake - Lunar Lake
- Panther Lake
config PINCTRL_ALDERLAKE config PINCTRL_ALDERLAKE
tristate "Intel Alder Lake pinctrl and GPIO driver" tristate "Intel Alder Lake pinctrl and GPIO driver"
......
...@@ -90,7 +90,6 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev, ...@@ -90,7 +90,6 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev,
struct intel_community *community, struct intel_community *community,
struct intel_platform_pins *pins) struct intel_platform_pins *pins)
{ {
struct fwnode_handle *child;
struct intel_padgroup *gpps; struct intel_padgroup *gpps;
unsigned int group; unsigned int group;
size_t ngpps; size_t ngpps;
...@@ -131,7 +130,7 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev, ...@@ -131,7 +130,7 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev,
return -ENOMEM; return -ENOMEM;
group = 0; group = 0;
device_for_each_child_node(dev, child) { device_for_each_child_node_scoped(dev, child) {
struct intel_padgroup *gpp = &gpps[group]; struct intel_padgroup *gpp = &gpps[group];
gpp->reg_num = group; gpp->reg_num = group;
...@@ -159,7 +158,7 @@ static int intel_platform_pinctrl_prepare_soc_data(struct device *dev, ...@@ -159,7 +158,7 @@ static int intel_platform_pinctrl_prepare_soc_data(struct device *dev,
int ret; int ret;
/* Version 1.0 of the specification assumes only a single community per device node */ /* Version 1.0 of the specification assumes only a single community per device node */
ncommunities = 1, ncommunities = 1;
communities = devm_kcalloc(dev, ncommunities, sizeof(*communities), GFP_KERNEL); communities = devm_kcalloc(dev, ncommunities, sizeof(*communities), GFP_KERNEL);
if (!communities) if (!communities)
return -ENOMEM; return -ENOMEM;
......
...@@ -218,7 +218,7 @@ static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev, ...@@ -218,7 +218,7 @@ static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev,
} }
map_num += grp->npins; map_num += grp->npins;
new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), GFP_KERNEL); new_map = kcalloc(map_num, sizeof(*new_map), GFP_KERNEL);
if (!new_map) if (!new_map)
return -ENOMEM; return -ENOMEM;
......
...@@ -474,6 +474,9 @@ static int apple_gpio_pinctrl_probe(struct platform_device *pdev) ...@@ -474,6 +474,9 @@ static int apple_gpio_pinctrl_probe(struct platform_device *pdev)
for (i = 0; i < npins; i++) { for (i = 0; i < npins; i++) {
pins[i].number = i; pins[i].number = i;
pins[i].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "PIN%u", i); pins[i].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "PIN%u", i);
if (!pins[i].name)
return -ENOMEM;
pins[i].drv_data = pctl; pins[i].drv_data = pctl;
pin_names[i] = pins[i].name; pin_names[i] = pins[i].name;
pin_nums[i] = i; pin_nums[i] = i;
......
...@@ -987,8 +987,10 @@ static int aw9523_probe(struct i2c_client *client) ...@@ -987,8 +987,10 @@ static int aw9523_probe(struct i2c_client *client)
lockdep_set_subclass(&awi->i2c_lock, i2c_adapter_depth(client->adapter)); lockdep_set_subclass(&awi->i2c_lock, i2c_adapter_depth(client->adapter));
pdesc = devm_kzalloc(dev, sizeof(*pdesc), GFP_KERNEL); pdesc = devm_kzalloc(dev, sizeof(*pdesc), GFP_KERNEL);
if (!pdesc) if (!pdesc) {
return -ENOMEM; ret = -ENOMEM;
goto err_disable_vregs;
}
ret = aw9523_hw_init(awi); ret = aw9523_hw_init(awi);
if (ret) if (ret)
......
...@@ -1955,21 +1955,21 @@ static void ocelot_irq_handler(struct irq_desc *desc) ...@@ -1955,21 +1955,21 @@ static void ocelot_irq_handler(struct irq_desc *desc)
unsigned int reg = 0, irq, i; unsigned int reg = 0, irq, i;
unsigned long irqs; unsigned long irqs;
chained_irq_enter(parent_chip, desc);
for (i = 0; i < info->stride; i++) { for (i = 0; i < info->stride; i++) {
regmap_read(info->map, id_reg + 4 * i, &reg); regmap_read(info->map, id_reg + 4 * i, &reg);
if (!reg) if (!reg)
continue; continue;
chained_irq_enter(parent_chip, desc);
irqs = reg; irqs = reg;
for_each_set_bit(irq, &irqs, for_each_set_bit(irq, &irqs,
min(32U, info->desc->npins - 32 * i)) min(32U, info->desc->npins - 32 * i))
generic_handle_domain_irq(chip->irq.domain, irq + 32 * i); generic_handle_domain_irq(chip->irq.domain, irq + 32 * i);
chained_irq_exit(parent_chip, desc);
} }
chained_irq_exit(parent_chip, desc);
} }
static int ocelot_gpiochip_register(struct platform_device *pdev, static int ocelot_gpiochip_register(struct platform_device *pdev,
......
...@@ -221,7 +221,7 @@ static int cv1800_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -221,7 +221,7 @@ static int cv1800_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
if (!grpnames) if (!grpnames)
return -ENOMEM; return -ENOMEM;
map = devm_kcalloc(dev, ngroups * 2, sizeof(*map), GFP_KERNEL); map = kcalloc(ngroups * 2, sizeof(*map), GFP_KERNEL);
if (!map) if (!map)
return -ENOMEM; return -ENOMEM;
......
...@@ -1374,10 +1374,15 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode ...@@ -1374,10 +1374,15 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
for (i = 0; i < npins; i++) { for (i = 0; i < npins; i++) {
stm32_pin = stm32_pctrl_get_desc_pin_from_gpio(pctl, bank, i); stm32_pin = stm32_pctrl_get_desc_pin_from_gpio(pctl, bank, i);
if (stm32_pin && stm32_pin->pin.name) if (stm32_pin && stm32_pin->pin.name) {
names[i] = devm_kasprintf(dev, GFP_KERNEL, "%s", stm32_pin->pin.name); names[i] = devm_kasprintf(dev, GFP_KERNEL, "%s", stm32_pin->pin.name);
else if (!names[i]) {
err = -ENOMEM;
goto err_clk;
}
} else {
names[i] = NULL; names[i] = NULL;
}
} }
bank->gpio_chip.names = (const char * const *)names; bank->gpio_chip.names = (const char * const *)names;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment