提交 a6b9ede1 编写于 作者: D Dmitry Torokhov 提交者: Lorenzo Pieralisi

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: 1e33888f ("PCI: apple: Add initial hardware bring-up")
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: NLorenzo Pieralisi <lpieralisi@kernel.org>
Reviewed-by: NHector Martin <marcan@marcan.st>
Acked-by: NMarc Zyngier <maz@kernel.org>
上级 568035b0
...@@ -516,8 +516,8 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie, ...@@ -516,8 +516,8 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
u32 stat, idx; u32 stat, idx;
int ret, i; int ret, i;
reset = gpiod_get_from_of_node(np, "reset-gpios", 0, reset = devm_fwnode_gpiod_get(pcie->dev, of_fwnode_handle(np), "reset",
GPIOD_OUT_LOW, "PERST#"); GPIOD_OUT_LOW, "PERST#");
if (IS_ERR(reset)) if (IS_ERR(reset))
return PTR_ERR(reset); return PTR_ERR(reset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册