Skip to content

Commit 79eeab1

Browse files
author
Bartosz Golaszewski
committed
gpio: sim: fix a memory leak
Fix an inverted logic bug in gpio_sim_remove_hogs() that leads to GPIO hog structures never being freed. Fixes: cb8c474 ("gpio: sim: new testing module") Reported-by: Mirsad Goran Todorovac <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
1 parent b8b3b0b commit 79eeab1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpio/gpio-sim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ static void gpio_sim_remove_hogs(struct gpio_sim_device *dev)
736736

737737
gpiod_remove_hogs(dev->hogs);
738738

739-
for (hog = dev->hogs; !hog->chip_label; hog++) {
739+
for (hog = dev->hogs; hog->chip_label; hog++) {
740740
kfree(hog->chip_label);
741741
kfree(hog->line_name);
742742
}

0 commit comments

Comments
 (0)