diff options
author | Ladislav Michl | 2017-09-08 01:35:22 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab | 2017-10-04 20:27:17 +0200 |
commit | 08d94274b8d0c25551b29a069334d8e627333a82 (patch) | |
tree | 84774aae54bf0f0f2f796389ced08586babbf58c | |
parent | [media] media: rc: gpio-ir-recv: use helper variable to access device info (diff) | |
download | kernel-qcow2-linux-08d94274b8d0c25551b29a069334d8e627333a82.tar.gz kernel-qcow2-linux-08d94274b8d0c25551b29a069334d8e627333a82.tar.xz kernel-qcow2-linux-08d94274b8d0c25551b29a069334d8e627333a82.zip |
[media] media: rc: gpio-ir-recv: use devm_kzalloc
Use of devm_kzalloc 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>
-rw-r--r-- | drivers/media/rc/gpio-ir-recv.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c index 741a68c192ce..6fe7e7c14fe4 100644 --- a/drivers/media/rc/gpio-ir-recv.c +++ b/drivers/media/rc/gpio-ir-recv.c @@ -118,15 +118,13 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) if (pdata->gpio_nr < 0) return -EINVAL; - gpio_dev = kzalloc(sizeof(struct gpio_rc_dev), GFP_KERNEL); + gpio_dev = devm_kzalloc(dev, sizeof(*gpio_dev), GFP_KERNEL); if (!gpio_dev) return -ENOMEM; rcdev = rc_allocate_device(RC_DRIVER_IR_RAW); - if (!rcdev) { - rc = -ENOMEM; - goto err_allocate_device; - } + if (!rcdev) + return -ENOMEM; rcdev->priv = gpio_dev; rcdev->device_name = GPIO_IR_DEVICE_NAME; @@ -182,8 +180,6 @@ err_gpio_direction_input: gpio_free(pdata->gpio_nr); err_gpio_request: rc_free_device(rcdev); -err_allocate_device: - kfree(gpio_dev); return rc; } @@ -194,7 +190,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); - kfree(gpio_dev); return 0; } |