[PATCH leds v2 40/50] leds: ns2: use devres API for getting GPIO descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This drivers leaks GPIO descriptors on driver removal. Use devres API
function devm_gpiod_get_from_of_node instead of gpiod_get_from_of_node
to avoid this.

Signed-off-by: Marek Behún <marek.behun@xxxxxx>
Cc: Simon Guinot <simon.guinot@xxxxxxxxxxxx>
Cc: Simon Guinot <sguinot@xxxxxxxxx>
Cc: Vincent Donnefort <vdonnefort@xxxxxxxxx>
Cc: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxxxxxxxxx>
Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
 drivers/leds/leds-ns2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index 46d4f7e963c04..fa06ab40ee143 100644
--- a/drivers/leds/leds-ns2.c
+++ b/drivers/leds/leds-ns2.c
@@ -240,13 +240,13 @@ static int ns2_leds_parse_one(struct device *dev, struct device_node *np,
 	if (ret)
 		led->name = np->name;
 
-	led->cmd = gpiod_get_from_of_node(np, "cmd-gpio", 0, GPIOD_ASIS,
-					  led->name);
+	led->cmd = devm_gpiod_get_from_of_node(dev, np, "cmd-gpio", 0,
+					       GPIOD_ASIS, led->name);
 	if (IS_ERR(led->cmd))
 		return PTR_ERR(led->cmd);
 
-	led->slow = gpiod_get_from_of_node(np, "slow-gpio", 0, GPIOD_ASIS,
-					   led->name);
+	led->slow = devm_gpiod_get_from_of_node(dev, np, "slow-gpio", 0,
+						GPIOD_ASIS, led->name);
 	if (IS_ERR(led->slow))
 		return PTR_ERR(led->slow);
 
-- 
2.26.2




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux