Commit ef3d549
spi: sn-f-ospi: Fix resource leak in f_ospi_probe()
In f_ospi_probe(), when num_cs validation fails, it returns without
calling spi_controller_put() on the SPI controller, which causes a
resource leak.
Use devm_spi_alloc_host() instead of spi_alloc_host() to ensure the
SPI controller is properly freed when probe fails.
Fixes: 1b74dd6 ("spi: Add Socionext F_OSPI SPI flash controller driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Link: https://patch.msgid.link/20260319-sn-f-v1-1-33a6738d2da8@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>1 parent c369299 commit ef3d549
1 file changed
Lines changed: 5 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
615 | | - | |
| 615 | + | |
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
| 638 | + | |
| 639 | + | |
642 | 640 | | |
643 | 641 | | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
| 642 | + | |
| 643 | + | |
648 | 644 | | |
649 | 645 | | |
650 | 646 | | |
| |||
661 | 657 | | |
662 | 658 | | |
663 | 659 | | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | 660 | | |
668 | 661 | | |
669 | 662 | | |
| |||
0 commit comments