diff options
Diffstat (limited to 'drivers/media/rc/nuvoton-cir.c')
-rw-r--r-- | drivers/media/rc/nuvoton-cir.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index b8aa9abb31ff..40125d779049 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c | |||
@@ -986,25 +986,25 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | |||
986 | /* input device for IR remote (and tx) */ | 986 | /* input device for IR remote (and tx) */ |
987 | rdev = rc_allocate_device(); | 987 | rdev = rc_allocate_device(); |
988 | if (!rdev) | 988 | if (!rdev) |
989 | goto failure; | 989 | goto exit_free_dev_rdev; |
990 | 990 | ||
991 | ret = -ENODEV; | 991 | ret = -ENODEV; |
992 | /* validate pnp resources */ | 992 | /* validate pnp resources */ |
993 | if (!pnp_port_valid(pdev, 0) || | 993 | if (!pnp_port_valid(pdev, 0) || |
994 | pnp_port_len(pdev, 0) < CIR_IOREG_LENGTH) { | 994 | pnp_port_len(pdev, 0) < CIR_IOREG_LENGTH) { |
995 | dev_err(&pdev->dev, "IR PNP Port not valid!\n"); | 995 | dev_err(&pdev->dev, "IR PNP Port not valid!\n"); |
996 | goto failure; | 996 | goto exit_free_dev_rdev; |
997 | } | 997 | } |
998 | 998 | ||
999 | if (!pnp_irq_valid(pdev, 0)) { | 999 | if (!pnp_irq_valid(pdev, 0)) { |
1000 | dev_err(&pdev->dev, "PNP IRQ not valid!\n"); | 1000 | dev_err(&pdev->dev, "PNP IRQ not valid!\n"); |
1001 | goto failure; | 1001 | goto exit_free_dev_rdev; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | if (!pnp_port_valid(pdev, 1) || | 1004 | if (!pnp_port_valid(pdev, 1) || |
1005 | pnp_port_len(pdev, 1) < CIR_IOREG_LENGTH) { | 1005 | pnp_port_len(pdev, 1) < CIR_IOREG_LENGTH) { |
1006 | dev_err(&pdev->dev, "Wake PNP Port not valid!\n"); | 1006 | dev_err(&pdev->dev, "Wake PNP Port not valid!\n"); |
1007 | goto failure; | 1007 | goto exit_free_dev_rdev; |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | nvt->cir_addr = pnp_port_start(pdev, 0); | 1010 | 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 | 1027 | ||
1028 | ret = nvt_hw_detect(nvt); | 1028 | ret = nvt_hw_detect(nvt); |
1029 | if (ret) | 1029 | if (ret) |
1030 | goto failure; | 1030 | goto exit_free_dev_rdev; |
1031 | 1031 | ||
1032 | /* Initialize CIR & CIR Wake Logical Devices */ | 1032 | /* Initialize CIR & CIR Wake Logical Devices */ |
1033 | nvt_efm_enable(nvt); | 1033 | nvt_efm_enable(nvt); |
@@ -1065,31 +1065,32 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | |||
1065 | /* tx bits */ | 1065 | /* tx bits */ |
1066 | rdev->tx_resolution = XYZ; | 1066 | rdev->tx_resolution = XYZ; |
1067 | #endif | 1067 | #endif |
1068 | nvt->rdev = rdev; | ||
1069 | |||
1070 | ret = rc_register_device(rdev); | ||
1071 | if (ret) | ||
1072 | goto exit_free_dev_rdev; | ||
1068 | 1073 | ||
1069 | ret = -EBUSY; | 1074 | ret = -EBUSY; |
1070 | /* now claim resources */ | 1075 | /* now claim resources */ |
1071 | if (!request_region(nvt->cir_addr, | 1076 | if (!request_region(nvt->cir_addr, |
1072 | CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) | 1077 | CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) |
1073 | goto failure; | 1078 | goto exit_unregister_device; |
1074 | 1079 | ||
1075 | if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED, | 1080 | if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED, |
1076 | NVT_DRIVER_NAME, (void *)nvt)) | 1081 | NVT_DRIVER_NAME, (void *)nvt)) |
1077 | goto failure2; | 1082 | goto exit_release_cir_addr; |
1078 | 1083 | ||
1079 | if (!request_region(nvt->cir_wake_addr, | 1084 | if (!request_region(nvt->cir_wake_addr, |
1080 | CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) | 1085 | CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) |
1081 | goto failure3; | 1086 | goto exit_free_irq; |
1082 | 1087 | ||
1083 | if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED, | 1088 | if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED, |
1084 | NVT_DRIVER_NAME, (void *)nvt)) | 1089 | NVT_DRIVER_NAME, (void *)nvt)) |
1085 | goto failure4; | 1090 | goto exit_release_cir_wake_addr; |
1086 | |||
1087 | ret = rc_register_device(rdev); | ||
1088 | if (ret) | ||
1089 | goto failure5; | ||
1090 | 1091 | ||
1091 | device_init_wakeup(&pdev->dev, true); | 1092 | device_init_wakeup(&pdev->dev, true); |
1092 | nvt->rdev = rdev; | 1093 | |
1093 | nvt_pr(KERN_NOTICE, "driver has been successfully loaded\n"); | 1094 | nvt_pr(KERN_NOTICE, "driver has been successfully loaded\n"); |
1094 | if (debug) { | 1095 | if (debug) { |
1095 | cir_dump_regs(nvt); | 1096 | cir_dump_regs(nvt); |
@@ -1098,15 +1099,15 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | |||
1098 | 1099 | ||
1099 | return 0; | 1100 | return 0; |
1100 | 1101 | ||
1101 | failure5: | 1102 | exit_release_cir_wake_addr: |
1102 | free_irq(nvt->cir_wake_irq, nvt); | ||
1103 | failure4: | ||
1104 | release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH); | 1103 | release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH); |
1105 | failure3: | 1104 | exit_free_irq: |
1106 | free_irq(nvt->cir_irq, nvt); | 1105 | free_irq(nvt->cir_irq, nvt); |
1107 | failure2: | 1106 | exit_release_cir_addr: |
1108 | release_region(nvt->cir_addr, CIR_IOREG_LENGTH); | 1107 | release_region(nvt->cir_addr, CIR_IOREG_LENGTH); |
1109 | failure: | 1108 | exit_unregister_device: |
1109 | rc_unregister_device(rdev); | ||
1110 | exit_free_dev_rdev: | ||
1110 | rc_free_device(rdev); | 1111 | rc_free_device(rdev); |
1111 | kfree(nvt); | 1112 | kfree(nvt); |
1112 | 1113 | ||