Skip to content

Commit

Permalink
Merge tag 'gpio-v5.1-rc3-fixes-for-linus' of git://git.kernel.org/pub…
Browse files Browse the repository at this point in the history
…/scm/linux/kernel/git/brgl/linux into fixes

gpio fixes for v5.1-rc3

- fix for a potential NULL-pointer dereference in the aspeed driver
- revert of the commit using the new gpio_set_config() when setting
  debaunce and transitory state config as it caused a regression in
  the aspeed driver
- two fixes for gpio-mockup for debugfs problems introduced in the
  last merge window
  • Loading branch information
linusw committed Mar 29, 2019
2 parents f7299d4 + ce9fb53 commit 86d0756
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 2 additions & 0 deletions drivers/gpio/gpio-aspeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)

gpio->offset_timer =
devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL);
if (!gpio->offset_timer)
return -ENOMEM;

return aspeed_gpio_setup_irqs(gpio, pdev);
}
Expand Down
10 changes: 3 additions & 7 deletions drivers/gpio/gpio-mockup.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
struct gpio_mockup_chip *chip;
struct seq_file *sfile;
struct gpio_chip *gc;
int val, cnt;
char buf[3];
int val, rv;

if (*ppos != 0)
return 0;
Expand All @@ -216,13 +216,9 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
gc = &chip->gc;

val = gpio_mockup_get(gc, priv->offset);
snprintf(buf, sizeof(buf), "%d\n", val);
cnt = snprintf(buf, sizeof(buf), "%d\n", val);

rv = copy_to_user(usr_buf, buf, sizeof(buf));
if (rv)
return rv;

return sizeof(buf) - 1;
return simple_read_from_buffer(usr_buf, size, ppos, buf, cnt);
}

static ssize_t gpio_mockup_debugfs_write(struct file *file,
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2776,7 +2776,7 @@ int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
}

config = pinconf_to_config_packed(PIN_CONFIG_INPUT_DEBOUNCE, debounce);
return gpio_set_config(chip, gpio_chip_hwgpio(desc), config);
return chip->set_config(chip, gpio_chip_hwgpio(desc), config);
}
EXPORT_SYMBOL_GPL(gpiod_set_debounce);

Expand Down Expand Up @@ -2813,7 +2813,7 @@ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE,
!transitory);
gpio = gpio_chip_hwgpio(desc);
rc = gpio_set_config(chip, gpio, packed);
rc = chip->set_config(chip, gpio, packed);
if (rc == -ENOTSUPP) {
dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n",
gpio);
Expand Down

0 comments on commit 86d0756

Please sign in to comment.