Skip to content

Commit a6b9ede

Browse files
dtorLorenzo Pieralisi
authored andcommitted
PCI: apple: Do not leak reset GPIO on unbind/unload/error
The driver allocates reset GPIO in apple_pcie_setup_port() but neither releases the resource, nor uses devm API to have it released automatically. Let's fix this by switching to devm API. While at it let's use generic devm_fwnode_gpiod_get() instead of OF-specific gpiod_get_from_of_node() - this will allow us top stop exporting the latter down the road. Link: https://lore.kernel.org/r/YxatO5OaI2RpxQ2M@google.com Fixes: 1e33888 ("PCI: apple: Add initial hardware bring-up") Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Reviewed-by: Hector Martin <marcan@marcan.st> Acked-by: Marc Zyngier <maz@kernel.org>
1 parent 568035b commit a6b9ede

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pci/controller/pcie-apple.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
516516
u32 stat, idx;
517517
int ret, i;
518518

519-
reset = gpiod_get_from_of_node(np, "reset-gpios", 0,
520-
GPIOD_OUT_LOW, "PERST#");
519+
reset = devm_fwnode_gpiod_get(pcie->dev, of_fwnode_handle(np), "reset",
520+
GPIOD_OUT_LOW, "PERST#");
521521
if (IS_ERR(reset))
522522
return PTR_ERR(reset);
523523

0 commit comments

Comments
 (0)