aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2017-09-07 20:36:39 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2017-10-04 15:30:25 -0300
commitfcca09edb9f6e406de6014e3f1c2695b15b52abb (patch)
tree6e937069b8fd4034e3e1c80830c967621b080226 /drivers/media/rc
parentf4940b563feff6f2514fc8c5309b844b0540a4cb (diff)
[media] media: rc: gpio-ir-recv: use devm_gpio_request_one
Use of devm_gpio_request_one simplifies error unwinding. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/gpio-ir-recv.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 98dcb8399506..77044d664371 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -148,12 +148,10 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
gpio_dev->gpio_nr = pdata->gpio_nr;
gpio_dev->active_low = pdata->active_low;
- rc = gpio_request(pdata->gpio_nr, "gpio-ir-recv");
+ rc = devm_gpio_request_one(dev, pdata->gpio_nr, GPIOF_DIR_IN,
+ "gpio-ir-recv");
if (rc < 0)
return rc;
- rc = gpio_direction_input(pdata->gpio_nr);
- if (rc < 0)
- goto err_gpio_direction_input;
rc = rc_register_device(rcdev);
if (rc < 0) {
@@ -176,8 +174,6 @@ err_request_irq:
rc_unregister_device(rcdev);
rcdev = NULL;
err_register_rc_device:
-err_gpio_direction_input:
- gpio_free(pdata->gpio_nr);
return rc;
}
@@ -187,7 +183,6 @@ static int gpio_ir_recv_remove(struct platform_device *pdev)
free_irq(gpio_to_irq(gpio_dev->gpio_nr), gpio_dev);
rc_unregister_device(gpio_dev->rcdev);
- gpio_free(gpio_dev->gpio_nr);
return 0;
}

Privacy Policy