Commit 70ef6991 authored by Matthijs Kooijman's avatar Matthijs Kooijman Committed by Mauro Carvalho Chehab

[media] rc: Make probe cleanup goto labels more verbose

Before, labels were simply numbered. Now, the labels are named after the
cleanup action they'll perform (first), based on how the winbond-cir
driver does it. This makes the code a bit more clear and makes changes
in the ordering of labels easier to review.
This change is applied only to the rc drivers that do significant
cleanup in their probe functions: ati-remote, ene-ir, fintek-cir,
gpio-ir-recv, ite-cir, nuvoton-cir.
This commit should not change any code, it just renames goto labels.

[mchehab@redhat.com: removed changes at gpio-ir-recv.c, due to
 merge conflicts]
Signed-off-by: default avatarMatthijs Kooijman <matthijs@stdin.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d40fbf8d
...@@ -872,11 +872,11 @@ static int ati_remote_probe(struct usb_interface *interface, ...@@ -872,11 +872,11 @@ static int ati_remote_probe(struct usb_interface *interface,
ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL); ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL);
rc_dev = rc_allocate_device(); rc_dev = rc_allocate_device();
if (!ati_remote || !rc_dev) if (!ati_remote || !rc_dev)
goto fail1; goto exit_free_dev_rdev;
/* Allocate URB buffers, URBs */ /* Allocate URB buffers, URBs */
if (ati_remote_alloc_buffers(udev, ati_remote)) if (ati_remote_alloc_buffers(udev, ati_remote))
goto fail2; goto exit_free_buffers;
ati_remote->endpoint_in = endpoint_in; ati_remote->endpoint_in = endpoint_in;
ati_remote->endpoint_out = endpoint_out; ati_remote->endpoint_out = endpoint_out;
...@@ -924,12 +924,12 @@ static int ati_remote_probe(struct usb_interface *interface, ...@@ -924,12 +924,12 @@ static int ati_remote_probe(struct usb_interface *interface,
/* Device Hardware Initialization - fills in ati_remote->idev from udev. */ /* Device Hardware Initialization - fills in ati_remote->idev from udev. */
err = ati_remote_initialize(ati_remote); err = ati_remote_initialize(ati_remote);
if (err) if (err)
goto fail3; goto exit_kill_urbs;
/* Set up and register rc device */ /* Set up and register rc device */
err = rc_register_device(ati_remote->rdev); err = rc_register_device(ati_remote->rdev);
if (err) if (err)
goto fail3; goto exit_kill_urbs;
/* use our delay for rc_dev */ /* use our delay for rc_dev */
ati_remote->rdev->input_dev->rep[REP_DELAY] = repeat_delay; ati_remote->rdev->input_dev->rep[REP_DELAY] = repeat_delay;
...@@ -939,7 +939,7 @@ static int ati_remote_probe(struct usb_interface *interface, ...@@ -939,7 +939,7 @@ static int ati_remote_probe(struct usb_interface *interface,
input_dev = input_allocate_device(); input_dev = input_allocate_device();
if (!input_dev) { if (!input_dev) {
err = -ENOMEM; err = -ENOMEM;
goto fail4; goto exit_unregister_device;
} }
ati_remote->idev = input_dev; ati_remote->idev = input_dev;
...@@ -947,19 +947,24 @@ static int ati_remote_probe(struct usb_interface *interface, ...@@ -947,19 +947,24 @@ static int ati_remote_probe(struct usb_interface *interface,
err = input_register_device(input_dev); err = input_register_device(input_dev);
if (err) if (err)
goto fail5; goto exit_free_input_device;
} }
usb_set_intfdata(interface, ati_remote); usb_set_intfdata(interface, ati_remote);
return 0; return 0;
fail5: input_free_device(input_dev); exit_free_input_device:
fail4: rc_unregister_device(rc_dev); input_free_device(input_dev);
exit_unregister_device:
rc_unregister_device(rc_dev);
rc_dev = NULL; rc_dev = NULL;
fail3: usb_kill_urb(ati_remote->irq_urb); exit_kill_urbs:
usb_kill_urb(ati_remote->irq_urb);
usb_kill_urb(ati_remote->out_urb); usb_kill_urb(ati_remote->out_urb);
fail2: ati_remote_free_buffers(ati_remote); exit_free_buffers:
fail1: rc_free_device(rc_dev); ati_remote_free_buffers(ati_remote);
exit_free_dev_rdev:
rc_free_device(rc_dev);
kfree(ati_remote); kfree(ati_remote);
return err; return err;
} }
......
...@@ -1003,7 +1003,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) ...@@ -1003,7 +1003,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL); dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL);
rdev = rc_allocate_device(); rdev = rc_allocate_device();
if (!dev || !rdev) if (!dev || !rdev)
goto failure; goto exit_free_dev_rdev;
/* validate resources */ /* validate resources */
error = -ENODEV; error = -ENODEV;
...@@ -1014,10 +1014,10 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) ...@@ -1014,10 +1014,10 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
if (!pnp_port_valid(pnp_dev, 0) || if (!pnp_port_valid(pnp_dev, 0) ||
pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE) pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE)
goto failure; goto exit_free_dev_rdev;
if (!pnp_irq_valid(pnp_dev, 0)) if (!pnp_irq_valid(pnp_dev, 0))
goto failure; goto exit_free_dev_rdev;
spin_lock_init(&dev->hw_lock); spin_lock_init(&dev->hw_lock);
...@@ -1033,7 +1033,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) ...@@ -1033,7 +1033,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
/* detect hardware version and features */ /* detect hardware version and features */
error = ene_hw_detect(dev); error = ene_hw_detect(dev);
if (error) if (error)
goto failure; goto exit_free_dev_rdev;
if (!dev->hw_learning_and_tx_capable && txsim) { if (!dev->hw_learning_and_tx_capable && txsim) {
dev->hw_learning_and_tx_capable = true; dev->hw_learning_and_tx_capable = true;
...@@ -1078,27 +1078,27 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) ...@@ -1078,27 +1078,27 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
/* claim the resources */ /* claim the resources */
error = -EBUSY; error = -EBUSY;
if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) { if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) {
goto failure; goto exit_free_dev_rdev;
} }
dev->irq = pnp_irq(pnp_dev, 0); dev->irq = pnp_irq(pnp_dev, 0);
if (request_irq(dev->irq, ene_isr, if (request_irq(dev->irq, ene_isr,
IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) { IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) {
goto failure2; goto exit_release_hw_io;
} }
error = rc_register_device(rdev); error = rc_register_device(rdev);
if (error < 0) if (error < 0)
goto failure3; goto exit_free_irq;
pr_notice("driver has been successfully loaded\n"); pr_notice("driver has been successfully loaded\n");
return 0; return 0;
failure3: exit_free_irq:
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
failure2: exit_release_hw_io:
release_region(dev->hw_io, ENE_IO_SIZE); release_region(dev->hw_io, ENE_IO_SIZE);
failure: exit_free_dev_rdev:
rc_free_device(rdev); rc_free_device(rdev);
kfree(dev); kfree(dev);
return error; return error;
......
...@@ -500,18 +500,18 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id ...@@ -500,18 +500,18 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
/* input device for IR remote (and tx) */ /* input device for IR remote (and tx) */
rdev = rc_allocate_device(); rdev = rc_allocate_device();
if (!rdev) if (!rdev)
goto failure; goto exit_free_dev_rdev;
ret = -ENODEV; ret = -ENODEV;
/* validate pnp resources */ /* validate pnp resources */
if (!pnp_port_valid(pdev, 0)) { if (!pnp_port_valid(pdev, 0)) {
dev_err(&pdev->dev, "IR PNP Port not valid!\n"); dev_err(&pdev->dev, "IR PNP Port not valid!\n");
goto failure; goto exit_free_dev_rdev;
} }
if (!pnp_irq_valid(pdev, 0)) { if (!pnp_irq_valid(pdev, 0)) {
dev_err(&pdev->dev, "IR PNP IRQ not valid!\n"); dev_err(&pdev->dev, "IR PNP IRQ not valid!\n");
goto failure; goto exit_free_dev_rdev;
} }
fintek->cir_addr = pnp_port_start(pdev, 0); fintek->cir_addr = pnp_port_start(pdev, 0);
...@@ -528,7 +528,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id ...@@ -528,7 +528,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
ret = fintek_hw_detect(fintek); ret = fintek_hw_detect(fintek);
if (ret) if (ret)
goto failure; goto exit_free_dev_rdev;
/* Initialize CIR & CIR Wake Logical Devices */ /* Initialize CIR & CIR Wake Logical Devices */
fintek_config_mode_enable(fintek); fintek_config_mode_enable(fintek);
...@@ -561,15 +561,15 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id ...@@ -561,15 +561,15 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
/* now claim resources */ /* now claim resources */
if (!request_region(fintek->cir_addr, if (!request_region(fintek->cir_addr,
fintek->cir_port_len, FINTEK_DRIVER_NAME)) fintek->cir_port_len, FINTEK_DRIVER_NAME))
goto failure; goto exit_free_dev_rdev;
if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED, if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
FINTEK_DRIVER_NAME, (void *)fintek)) FINTEK_DRIVER_NAME, (void *)fintek))
goto failure2; goto exit_free_cir_addr;
ret = rc_register_device(rdev); ret = rc_register_device(rdev);
if (ret) if (ret)
goto failure3; goto exit_free_irq;
device_init_wakeup(&pdev->dev, true); device_init_wakeup(&pdev->dev, true);
fintek->rdev = rdev; fintek->rdev = rdev;
...@@ -579,11 +579,11 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id ...@@ -579,11 +579,11 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
return 0; return 0;
failure3: exit_free_irq:
free_irq(fintek->cir_irq, fintek); free_irq(fintek->cir_irq, fintek);
failure2: exit_free_cir_addr:
release_region(fintek->cir_addr, fintek->cir_port_len); release_region(fintek->cir_addr, fintek->cir_port_len);
failure: exit_free_dev_rdev:
rc_free_device(rdev); rc_free_device(rdev);
kfree(fintek); kfree(fintek);
......
...@@ -1472,7 +1472,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id ...@@ -1472,7 +1472,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
/* input device for IR remote (and tx) */ /* input device for IR remote (and tx) */
rdev = rc_allocate_device(); rdev = rc_allocate_device();
if (!rdev) if (!rdev)
goto failure; goto exit_free_dev_rdev;
itdev->rdev = rdev; itdev->rdev = rdev;
ret = -ENODEV; ret = -ENODEV;
...@@ -1498,12 +1498,12 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id ...@@ -1498,12 +1498,12 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
if (!pnp_port_valid(pdev, io_rsrc_no) || if (!pnp_port_valid(pdev, io_rsrc_no) ||
pnp_port_len(pdev, io_rsrc_no) != dev_desc->io_region_size) { pnp_port_len(pdev, io_rsrc_no) != dev_desc->io_region_size) {
dev_err(&pdev->dev, "IR PNP Port not valid!\n"); dev_err(&pdev->dev, "IR PNP Port not valid!\n");
goto failure; goto exit_free_dev_rdev;
} }
if (!pnp_irq_valid(pdev, 0)) { if (!pnp_irq_valid(pdev, 0)) {
dev_err(&pdev->dev, "PNP IRQ not valid!\n"); dev_err(&pdev->dev, "PNP IRQ not valid!\n");
goto failure; goto exit_free_dev_rdev;
} }
/* store resource values */ /* store resource values */
...@@ -1595,25 +1595,25 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id ...@@ -1595,25 +1595,25 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
/* now claim resources */ /* now claim resources */
if (!request_region(itdev->cir_addr, if (!request_region(itdev->cir_addr,
dev_desc->io_region_size, ITE_DRIVER_NAME)) dev_desc->io_region_size, ITE_DRIVER_NAME))
goto failure; goto exit_free_dev_rdev;
if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED, if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
ITE_DRIVER_NAME, (void *)itdev)) ITE_DRIVER_NAME, (void *)itdev))
goto failure2; goto exit_release_cir_addr;
ret = rc_register_device(rdev); ret = rc_register_device(rdev);
if (ret) if (ret)
goto failure3; goto exit_free_irq;
ite_pr(KERN_NOTICE, "driver has been successfully loaded\n"); ite_pr(KERN_NOTICE, "driver has been successfully loaded\n");
return 0; return 0;
failure3: exit_free_irq:
free_irq(itdev->cir_irq, itdev); free_irq(itdev->cir_irq, itdev);
failure2: exit_release_cir_addr:
release_region(itdev->cir_addr, itdev->params.io_region_size); release_region(itdev->cir_addr, itdev->params.io_region_size);
failure: exit_free_dev_rdev:
rc_free_device(rdev); rc_free_device(rdev);
kfree(itdev); kfree(itdev);
......
...@@ -986,25 +986,25 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) ...@@ -986,25 +986,25 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
/* input device for IR remote (and tx) */ /* input device for IR remote (and tx) */
rdev = rc_allocate_device(); rdev = rc_allocate_device();
if (!rdev) if (!rdev)
goto failure; goto exit_free_dev_rdev;
ret = -ENODEV; ret = -ENODEV;
/* validate pnp resources */ /* validate pnp resources */
if (!pnp_port_valid(pdev, 0) || if (!pnp_port_valid(pdev, 0) ||
pnp_port_len(pdev, 0) < CIR_IOREG_LENGTH) { pnp_port_len(pdev, 0) < CIR_IOREG_LENGTH) {
dev_err(&pdev->dev, "IR PNP Port not valid!\n"); dev_err(&pdev->dev, "IR PNP Port not valid!\n");
goto failure; goto exit_free_dev_rdev;
} }
if (!pnp_irq_valid(pdev, 0)) { if (!pnp_irq_valid(pdev, 0)) {
dev_err(&pdev->dev, "PNP IRQ not valid!\n"); dev_err(&pdev->dev, "PNP IRQ not valid!\n");
goto failure; goto exit_free_dev_rdev;
} }
if (!pnp_port_valid(pdev, 1) || if (!pnp_port_valid(pdev, 1) ||
pnp_port_len(pdev, 1) < CIR_IOREG_LENGTH) { pnp_port_len(pdev, 1) < CIR_IOREG_LENGTH) {
dev_err(&pdev->dev, "Wake PNP Port not valid!\n"); dev_err(&pdev->dev, "Wake PNP Port not valid!\n");
goto failure; goto exit_free_dev_rdev;
} }
nvt->cir_addr = pnp_port_start(pdev, 0); nvt->cir_addr = pnp_port_start(pdev, 0);
...@@ -1027,7 +1027,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) ...@@ -1027,7 +1027,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
ret = nvt_hw_detect(nvt); ret = nvt_hw_detect(nvt);
if (ret) if (ret)
goto failure; goto exit_free_dev_rdev;
/* Initialize CIR & CIR Wake Logical Devices */ /* Initialize CIR & CIR Wake Logical Devices */
nvt_efm_enable(nvt); nvt_efm_enable(nvt);
...@@ -1070,23 +1070,23 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) ...@@ -1070,23 +1070,23 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
/* now claim resources */ /* now claim resources */
if (!request_region(nvt->cir_addr, if (!request_region(nvt->cir_addr,
CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
goto failure; goto exit_free_dev_rdev;
if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED, if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED,
NVT_DRIVER_NAME, (void *)nvt)) NVT_DRIVER_NAME, (void *)nvt))
goto failure2; goto exit_release_cir_addr;
if (!request_region(nvt->cir_wake_addr, if (!request_region(nvt->cir_wake_addr,
CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
goto failure3; goto exit_free_irq;
if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED, if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED,
NVT_DRIVER_NAME, (void *)nvt)) NVT_DRIVER_NAME, (void *)nvt))
goto failure4; goto exit_release_cir_wake_addr;
ret = rc_register_device(rdev); ret = rc_register_device(rdev);
if (ret) if (ret)
goto failure5; goto exit_free_wake_irq;
device_init_wakeup(&pdev->dev, true); device_init_wakeup(&pdev->dev, true);
nvt->rdev = rdev; nvt->rdev = rdev;
...@@ -1098,15 +1098,15 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) ...@@ -1098,15 +1098,15 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
return 0; return 0;
failure5: exit_free_wake_irq:
free_irq(nvt->cir_wake_irq, nvt); free_irq(nvt->cir_wake_irq, nvt);
failure4: exit_release_cir_wake_addr:
release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH); release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH);
failure3: exit_free_irq:
free_irq(nvt->cir_irq, nvt); free_irq(nvt->cir_irq, nvt);
failure2: exit_release_cir_addr:
release_region(nvt->cir_addr, CIR_IOREG_LENGTH); release_region(nvt->cir_addr, CIR_IOREG_LENGTH);
failure: exit_free_dev_rdev:
rc_free_device(rdev); rc_free_device(rdev);
kfree(nvt); kfree(nvt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment