diff options
Diffstat (limited to 'drivers/extcon/extcon_gpio.c')
| -rw-r--r-- | drivers/extcon/extcon_gpio.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/extcon/extcon_gpio.c b/drivers/extcon/extcon_gpio.c index 8a0dcc11c7c7..fe3db45fa83c 100644 --- a/drivers/extcon/extcon_gpio.c +++ b/drivers/extcon/extcon_gpio.c | |||
| @@ -105,25 +105,25 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev) | |||
| 105 | 105 | ||
| 106 | ret = extcon_dev_register(&extcon_data->edev, &pdev->dev); | 106 | ret = extcon_dev_register(&extcon_data->edev, &pdev->dev); |
| 107 | if (ret < 0) | 107 | if (ret < 0) |
| 108 | goto err_extcon_dev_register; | 108 | return ret; |
| 109 | 109 | ||
| 110 | ret = gpio_request_one(extcon_data->gpio, GPIOF_DIR_IN, pdev->name); | 110 | ret = gpio_request_one(extcon_data->gpio, GPIOF_DIR_IN, pdev->name); |
| 111 | if (ret < 0) | 111 | if (ret < 0) |
| 112 | goto err_request_gpio; | 112 | goto err; |
| 113 | 113 | ||
| 114 | INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work); | 114 | INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work); |
| 115 | 115 | ||
| 116 | extcon_data->irq = gpio_to_irq(extcon_data->gpio); | 116 | extcon_data->irq = gpio_to_irq(extcon_data->gpio); |
| 117 | if (extcon_data->irq < 0) { | 117 | if (extcon_data->irq < 0) { |
| 118 | ret = extcon_data->irq; | 118 | ret = extcon_data->irq; |
| 119 | goto err_detect_irq_num_failed; | 119 | goto err; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | ret = request_any_context_irq(extcon_data->irq, gpio_irq_handler, | 122 | ret = request_any_context_irq(extcon_data->irq, gpio_irq_handler, |
| 123 | pdata->irq_flags, pdev->name, | 123 | pdata->irq_flags, pdev->name, |
| 124 | extcon_data); | 124 | extcon_data); |
| 125 | if (ret < 0) | 125 | if (ret < 0) |
| 126 | goto err_request_irq; | 126 | goto err; |
| 127 | 127 | ||
| 128 | platform_set_drvdata(pdev, extcon_data); | 128 | platform_set_drvdata(pdev, extcon_data); |
| 129 | /* Perform initial detection */ | 129 | /* Perform initial detection */ |
| @@ -131,13 +131,8 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev) | |||
| 131 | 131 | ||
| 132 | return 0; | 132 | return 0; |
| 133 | 133 | ||
| 134 | err_request_irq: | 134 | err: |
| 135 | err_detect_irq_num_failed: | ||
| 136 | gpio_free(extcon_data->gpio); | ||
| 137 | err_request_gpio: | ||
| 138 | extcon_dev_unregister(&extcon_data->edev); | 135 | extcon_dev_unregister(&extcon_data->edev); |
| 139 | err_extcon_dev_register: | ||
| 140 | devm_kfree(&pdev->dev, extcon_data); | ||
| 141 | 136 | ||
| 142 | return ret; | 137 | return ret; |
| 143 | } | 138 | } |
| @@ -148,9 +143,7 @@ static int __devexit gpio_extcon_remove(struct platform_device *pdev) | |||
| 148 | 143 | ||
| 149 | cancel_delayed_work_sync(&extcon_data->work); | 144 | cancel_delayed_work_sync(&extcon_data->work); |
| 150 | free_irq(extcon_data->irq, extcon_data); | 145 | free_irq(extcon_data->irq, extcon_data); |
| 151 | gpio_free(extcon_data->gpio); | ||
| 152 | extcon_dev_unregister(&extcon_data->edev); | 146 | extcon_dev_unregister(&extcon_data->edev); |
| 153 | devm_kfree(&pdev->dev, extcon_data); | ||
| 154 | 147 | ||
| 155 | return 0; | 148 | return 0; |
| 156 | } | 149 | } |
