Commit 86d07565 authored by Linus Walleij's avatar Linus Walleij

Merge tag 'gpio-v5.1-rc3-fixes-for-linus' of...

Merge tag 'gpio-v5.1-rc3-fixes-for-linus' of git://git.kernel.org/pub/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
parents f7299d44 ce9fb53c
...@@ -1224,6 +1224,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) ...@@ -1224,6 +1224,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
gpio->offset_timer = gpio->offset_timer =
devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL);
if (!gpio->offset_timer)
return -ENOMEM;
return aspeed_gpio_setup_irqs(gpio, pdev); return aspeed_gpio_setup_irqs(gpio, pdev);
} }
......
...@@ -204,8 +204,8 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file, ...@@ -204,8 +204,8 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
struct gpio_mockup_chip *chip; struct gpio_mockup_chip *chip;
struct seq_file *sfile; struct seq_file *sfile;
struct gpio_chip *gc; struct gpio_chip *gc;
int val, cnt;
char buf[3]; char buf[3];
int val, rv;
if (*ppos != 0) if (*ppos != 0)
return 0; return 0;
...@@ -216,13 +216,9 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file, ...@@ -216,13 +216,9 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
gc = &chip->gc; gc = &chip->gc;
val = gpio_mockup_get(gc, priv->offset); 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)); return simple_read_from_buffer(usr_buf, size, ppos, buf, cnt);
if (rv)
return rv;
return sizeof(buf) - 1;
} }
static ssize_t gpio_mockup_debugfs_write(struct file *file, static ssize_t gpio_mockup_debugfs_write(struct file *file,
......
...@@ -2776,7 +2776,7 @@ int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) ...@@ -2776,7 +2776,7 @@ int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
} }
config = pinconf_to_config_packed(PIN_CONFIG_INPUT_DEBOUNCE, 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); EXPORT_SYMBOL_GPL(gpiod_set_debounce);
...@@ -2813,7 +2813,7 @@ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory) ...@@ -2813,7 +2813,7 @@ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE, packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE,
!transitory); !transitory);
gpio = gpio_chip_hwgpio(desc); gpio = gpio_chip_hwgpio(desc);
rc = gpio_set_config(chip, gpio, packed); rc = chip->set_config(chip, gpio, packed);
if (rc == -ENOTSUPP) { if (rc == -ENOTSUPP) {
dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n", dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n",
gpio); gpio);
......
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