Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+7 -9
+2
drivers/gpio/gpio-aspeed.c
··· 1224 1224 1225 1225 gpio->offset_timer = 1226 1226 devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); 1227 + if (!gpio->offset_timer) 1228 + return -ENOMEM; 1227 1229 1228 1230 return aspeed_gpio_setup_irqs(gpio, pdev); 1229 1231 }
+3 -7
drivers/gpio/gpio-mockup.c
··· 204 204 struct gpio_mockup_chip *chip; 205 205 struct seq_file *sfile; 206 206 struct gpio_chip *gc; 207 + int val, cnt; 207 208 char buf[3]; 208 - int val, rv; 209 209 210 210 if (*ppos != 0) 211 211 return 0; ··· 216 216 gc = &chip->gc; 217 217 218 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)); 222 - if (rv) 223 - return rv; 224 - 225 - return sizeof(buf) - 1; 221 + return simple_read_from_buffer(usr_buf, size, ppos, buf, cnt); 226 222 } 227 223 228 224 static ssize_t gpio_mockup_debugfs_write(struct file *file,
+2 -2
drivers/gpio/gpiolib.c
··· 2776 2776 } 2777 2777 2778 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 2781 EXPORT_SYMBOL_GPL(gpiod_set_debounce); 2782 2782 ··· 2813 2813 packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE, 2814 2814 !transitory); 2815 2815 gpio = gpio_chip_hwgpio(desc); 2816 - rc = gpio_set_config(chip, gpio, packed); 2816 + rc = chip->set_config(chip, gpio, packed); 2817 2817 if (rc == -ENOTSUPP) { 2818 2818 dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n", 2819 2819 gpio);