Skip to content

Commit 3b47bc0

Browse files
committed
Merge tag 'pinctrl-v6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: - Fix a really interesting potential core bug in the list iterator requireing the use of READ_ONCE() discovered when testing kernel compiles with clang. - Check devm_kcalloc() return value and an array bounds in the STM32 driver. - Fix an exotic string truncation issue in the s32cc driver, found by the kernel test robot (impressive!) - Fix an undocumented struct member in the cy8c95x0 driver. - Fix a symbol overlap with MIPS in the Lochnagar driver, MIPS defines a global symbol "RST" which is a bit too generic and collide with stuff. OK this one should be renamed too, we will fix that as well. - Fix erroneous branch taking in the Realtek driver. - Fix the mail address in MAINTAINERS for the s32g2 driver. * tag 'pinctrl-v6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: dt-bindings: pinctrl: s32g2: change a maintainer email address pinctrl: realtek: Fix logical error when finding descriptor pinctrl: lochnagar: Don't build on MIPS pinctrl: avoid reload of p state in list iteration pinctrl: cy8c95x0: Fix doc warning pinctrl: s32cc: Avoid possible string truncation pinctrl: stm32: fix array read out of bound pinctrl: stm32: Add check for devm_kcalloc
2 parents 18d46e7 + 90785ea commit 3b47bc0

File tree

7 files changed

+21
-12
lines changed

7 files changed

+21
-12
lines changed

Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ title: NXP S32G2 pin controller
99

1010
maintainers:
1111
- Ghennadi Procopciuc <[email protected]>
12-
- Chester Lin <clin@suse.com>
12+
- Chester Lin <chester62515@gmail.com>
1313

1414
description: |
1515
S32G2 pinmux is implemented in SIUL2 (System Integration Unit Lite2),

drivers/pinctrl/cirrus/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ config PINCTRL_CS42L43
1212

1313
config PINCTRL_LOCHNAGAR
1414
tristate "Cirrus Logic Lochnagar pinctrl driver"
15-
depends on MFD_LOCHNAGAR
15+
# Avoid clash caused by MIPS defining RST, which is used in the driver
16+
depends on MFD_LOCHNAGAR && !MIPS
1617
select GPIOLIB
1718
select PINMUX
1819
select PINCONF

drivers/pinctrl/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,17 +1262,17 @@ static void pinctrl_link_add(struct pinctrl_dev *pctldev,
12621262
static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
12631263
{
12641264
struct pinctrl_setting *setting, *setting2;
1265-
struct pinctrl_state *old_state = p->state;
1265+
struct pinctrl_state *old_state = READ_ONCE(p->state);
12661266
int ret;
12671267

1268-
if (p->state) {
1268+
if (old_state) {
12691269
/*
12701270
* For each pinmux setting in the old state, forget SW's record
12711271
* of mux owner for that pingroup. Any pingroups which are
12721272
* still owned by the new state will be re-acquired by the call
12731273
* to pinmux_enable_setting() in the loop below.
12741274
*/
1275-
list_for_each_entry(setting, &p->state->settings, node) {
1275+
list_for_each_entry(setting, &old_state->settings, node) {
12761276
if (setting->type != PIN_MAP_TYPE_MUX_GROUP)
12771277
continue;
12781278
pinmux_disable_setting(setting);

drivers/pinctrl/nxp/pinctrl-s32cc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,8 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev,
843843
if (!np)
844844
return -ENODEV;
845845

846-
if (mem_regions == 0) {
847-
dev_err(&pdev->dev, "mem_regions is 0\n");
846+
if (mem_regions == 0 || mem_regions >= 10000) {
847+
dev_err(&pdev->dev, "mem_regions is invalid: %u\n", mem_regions);
848848
return -EINVAL;
849849
}
850850

drivers/pinctrl/pinctrl-cy8c95x0.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ static const struct dmi_system_id cy8c95x0_dmi_acpi_irq_info[] = {
143143
* @pinctrl_desc: pin controller description
144144
* @name: Chip controller name
145145
* @tpin: Total number of pins
146+
* @gpio_reset: GPIO line handler that can reset the IC
146147
*/
147148
struct cy8c95x0_pinctrl {
148149
struct regmap *regmap;

drivers/pinctrl/realtek/pinctrl-rtd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static int rtd_pinctrl_get_function_groups(struct pinctrl_dev *pcdev,
146146

147147
static const struct rtd_pin_desc *rtd_pinctrl_find_mux(struct rtd_pinctrl *data, unsigned int pin)
148148
{
149-
if (!data->info->muxes[pin].name)
149+
if (data->info->muxes[pin].name)
150150
return &data->info->muxes[pin];
151151

152152
return NULL;
@@ -249,7 +249,7 @@ static const struct pinctrl_pin_desc
249249
static const struct rtd_pin_config_desc
250250
*rtd_pinctrl_find_config(struct rtd_pinctrl *data, unsigned int pin)
251251
{
252-
if (!data->info->configs[pin].name)
252+
if (data->info->configs[pin].name)
253253
return &data->info->configs[pin];
254254

255255
return NULL;

drivers/pinctrl/stm32/pinctrl-stm32.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,9 +1273,11 @@ static struct stm32_desc_pin *stm32_pctrl_get_desc_pin_from_gpio(struct stm32_pi
12731273
int i;
12741274

12751275
/* With few exceptions (e.g. bank 'Z'), pin number matches with pin index in array */
1276-
pin_desc = pctl->pins + stm32_pin_nb;
1277-
if (pin_desc->pin.number == stm32_pin_nb)
1278-
return pin_desc;
1276+
if (stm32_pin_nb < pctl->npins) {
1277+
pin_desc = pctl->pins + stm32_pin_nb;
1278+
if (pin_desc->pin.number == stm32_pin_nb)
1279+
return pin_desc;
1280+
}
12791281

12801282
/* Otherwise, loop all array to find the pin with the right number */
12811283
for (i = 0; i < pctl->npins; i++) {
@@ -1368,6 +1370,11 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
13681370
}
13691371

13701372
names = devm_kcalloc(dev, npins, sizeof(char *), GFP_KERNEL);
1373+
if (!names) {
1374+
err = -ENOMEM;
1375+
goto err_clk;
1376+
}
1377+
13711378
for (i = 0; i < npins; i++) {
13721379
stm32_pin = stm32_pctrl_get_desc_pin_from_gpio(pctl, bank, i);
13731380
if (stm32_pin && stm32_pin->pin.name)

0 commit comments

Comments
 (0)