Commit a619cba
gpio: virtuser: fix missing lookup table cleanups
When a virtuser device is created via configfs and the probe fails due
to an incorrect lookup table, the table is not removed. This prevents
subsequent probe attempts from succeeding, even if the issue is
corrected, unless the device is released. Additionally, cleanup is also
needed in the less likely case of platform_device_register_full()
failure.
Besides, a consistent memory leak in lookup_table->dev_id was spotted
using kmemleak by toggling the live state between 0 and 1 with a correct
lookup table.
Introduce gpio_virtuser_remove_lookup_table() as the counterpart to the
existing gpio_virtuser_make_lookup_table() and call it from all
necessary points to ensure proper cleanup.
Fixes: 91581c4 ("gpio: virtuser: new virtual testing driver for the GPIO API")
Signed-off-by: Koichiro Den <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>1 parent fc033cf commit a619cba
1 file changed
+25
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1439 | 1439 | | |
1440 | 1440 | | |
1441 | 1441 | | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
1442 | 1451 | | |
1443 | 1452 | | |
1444 | 1453 | | |
| |||
1487 | 1496 | | |
1488 | 1497 | | |
1489 | 1498 | | |
1490 | | - | |
1491 | | - | |
1492 | | - | |
1493 | | - | |
| 1499 | + | |
| 1500 | + | |
1494 | 1501 | | |
1495 | 1502 | | |
1496 | 1503 | | |
1497 | 1504 | | |
1498 | 1505 | | |
1499 | 1506 | | |
1500 | 1507 | | |
| 1508 | + | |
1501 | 1509 | | |
1502 | | - | |
1503 | | - | |
| 1510 | + | |
1504 | 1511 | | |
1505 | 1512 | | |
1506 | 1513 | | |
1507 | 1514 | | |
1508 | 1515 | | |
1509 | 1516 | | |
1510 | | - | |
1511 | | - | |
1512 | | - | |
| 1517 | + | |
| 1518 | + | |
1513 | 1519 | | |
1514 | 1520 | | |
1515 | 1521 | | |
1516 | 1522 | | |
1517 | 1523 | | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
1518 | 1533 | | |
1519 | 1534 | | |
1520 | 1535 | | |
| |||
1526 | 1541 | | |
1527 | 1542 | | |
1528 | 1543 | | |
| 1544 | + | |
1529 | 1545 | | |
1530 | 1546 | | |
1531 | | - | |
1532 | | - | |
1533 | 1547 | | |
1534 | 1548 | | |
1535 | 1549 | | |
| |||
0 commit comments