Skip to content

Commit 86d0756

Browse files
committed
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
2 parents f7299d4 + ce9fb53 commit 86d0756

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

drivers/gpio/gpio-aspeed.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
12241224

12251225
gpio->offset_timer =
12261226
devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL);
1227+
if (!gpio->offset_timer)
1228+
return -ENOMEM;
12271229

12281230
return aspeed_gpio_setup_irqs(gpio, pdev);
12291231
}

drivers/gpio/gpio-mockup.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
204204
struct gpio_mockup_chip *chip;
205205
struct seq_file *sfile;
206206
struct gpio_chip *gc;
207+
int val, cnt;
207208
char buf[3];
208-
int val, rv;
209209

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

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

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);
226222
}
227223

228224
static ssize_t gpio_mockup_debugfs_write(struct file *file,

drivers/gpio/gpiolib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
27762776
}
27772777

27782778
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);
27802780
}
27812781
EXPORT_SYMBOL_GPL(gpiod_set_debounce);
27822782

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

0 commit comments

Comments
 (0)