diff options
| author | Linus Walleij <linus.walleij@linaro.org> | 2019-03-28 22:04:47 -0400 |
|---|---|---|
| committer | Linus Walleij <linus.walleij@linaro.org> | 2019-03-28 22:04:47 -0400 |
| commit | 86d0756558b701b2c5502d90f705c2936008922d (patch) | |
| tree | 53273ade5de17e39af683ed48158bb58281883eb | |
| parent | f7299d441a4da8a5088e651ea55023525a793a13 (diff) | |
| parent | ce9fb53c72834646f26ecb2213e40e6876048f87 (diff) | |
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
| -rw-r--r-- | drivers/gpio/gpio-aspeed.c | 2 | ||||
| -rw-r--r-- | drivers/gpio/gpio-mockup.c | 10 | ||||
| -rw-r--r-- | drivers/gpio/gpiolib.c | 4 |
3 files changed, 7 insertions, 9 deletions
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 854bce4fb9e7..217507002dbc 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c | |||
| @@ -1224,6 +1224,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) | |||
| 1224 | 1224 | ||
| 1225 | gpio->offset_timer = | 1225 | gpio->offset_timer = |
| 1226 | devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); | 1226 | devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); |
| 1227 | if (!gpio->offset_timer) | ||
| 1228 | return -ENOMEM; | ||
| 1227 | 1229 | ||
| 1228 | return aspeed_gpio_setup_irqs(gpio, pdev); | 1230 | return aspeed_gpio_setup_irqs(gpio, pdev); |
| 1229 | } | 1231 | } |
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index 154d959e8993..b6a4efce7c92 100644 --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c | |||
| @@ -204,8 +204,8 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file, | |||
| 204 | struct gpio_mockup_chip *chip; | 204 | struct gpio_mockup_chip *chip; |
| 205 | struct seq_file *sfile; | 205 | struct seq_file *sfile; |
| 206 | struct gpio_chip *gc; | 206 | struct gpio_chip *gc; |
| 207 | int val, cnt; | ||
| 207 | char buf[3]; | 208 | char buf[3]; |
| 208 | int val, rv; | ||
| 209 | 209 | ||
| 210 | if (*ppos != 0) | 210 | if (*ppos != 0) |
| 211 | return 0; | 211 | return 0; |
| @@ -216,13 +216,9 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file, | |||
| 216 | gc = &chip->gc; | 216 | gc = &chip->gc; |
| 217 | 217 | ||
| 218 | val = gpio_mockup_get(gc, priv->offset); | 218 | val = gpio_mockup_get(gc, priv->offset); |
| 219 | snprintf(buf, sizeof(buf), "%d\n", val); | 219 | cnt = snprintf(buf, sizeof(buf), "%d\n", val); |
| 220 | 220 | ||
| 221 | rv = copy_to_user(usr_buf, buf, sizeof(buf)); | 221 | return simple_read_from_buffer(usr_buf, size, ppos, buf, cnt); |
| 222 | if (rv) | ||
| 223 | return rv; | ||
| 224 | |||
| 225 | return sizeof(buf) - 1; | ||
| 226 | } | 222 | } |
| 227 | 223 | ||
| 228 | static ssize_t gpio_mockup_debugfs_write(struct file *file, | 224 | static ssize_t gpio_mockup_debugfs_write(struct file *file, |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 144af0733581..0495bf1d480a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -2776,7 +2776,7 @@ int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) | |||
| 2776 | } | 2776 | } |
| 2777 | 2777 | ||
| 2778 | config = pinconf_to_config_packed(PIN_CONFIG_INPUT_DEBOUNCE, debounce); | 2778 | config = pinconf_to_config_packed(PIN_CONFIG_INPUT_DEBOUNCE, debounce); |
| 2779 | return gpio_set_config(chip, gpio_chip_hwgpio(desc), config); | 2779 | return chip->set_config(chip, gpio_chip_hwgpio(desc), config); |
| 2780 | } | 2780 | } |
| 2781 | EXPORT_SYMBOL_GPL(gpiod_set_debounce); | 2781 | EXPORT_SYMBOL_GPL(gpiod_set_debounce); |
| 2782 | 2782 | ||
| @@ -2813,7 +2813,7 @@ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory) | |||
| 2813 | packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE, | 2813 | packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE, |
| 2814 | !transitory); | 2814 | !transitory); |
| 2815 | gpio = gpio_chip_hwgpio(desc); | 2815 | gpio = gpio_chip_hwgpio(desc); |
| 2816 | rc = gpio_set_config(chip, gpio, packed); | 2816 | rc = chip->set_config(chip, gpio, packed); |
| 2817 | if (rc == -ENOTSUPP) { | 2817 | if (rc == -ENOTSUPP) { |
| 2818 | dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n", | 2818 | dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n", |
| 2819 | gpio); | 2819 | gpio); |
