diff options
author | Lee Jones <lee.jones@linaro.org> | 2014-11-03 11:12:26 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-11-25 11:18:50 -0500 |
commit | 6bdf891a17148a1b91beb603b09c599dc98eb4fb (patch) | |
tree | 228b2a02263a1394434819926e0d4a4660ea26fe /drivers/mfd | |
parent | 51a7e02bb629498c32915881ed4fb61ef778282a (diff) |
mfd: db8500-prcmu: Provide sane error path values
Also rid superfluous gotos and label.
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/db8500-prcmu.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 89ae8bf665b4..a8204730f01c 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c | |||
@@ -3150,27 +3150,27 @@ static int db8500_prcmu_probe(struct platform_device *pdev) | |||
3150 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu"); | 3150 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu"); |
3151 | if (!res) { | 3151 | if (!res) { |
3152 | dev_err(&pdev->dev, "no prcmu memory region provided\n"); | 3152 | dev_err(&pdev->dev, "no prcmu memory region provided\n"); |
3153 | return -ENOENT; | 3153 | return -EINVAL; |
3154 | } | 3154 | } |
3155 | prcmu_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); | 3155 | prcmu_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); |
3156 | if (!prcmu_base) { | 3156 | if (!prcmu_base) { |
3157 | dev_err(&pdev->dev, | 3157 | dev_err(&pdev->dev, |
3158 | "failed to ioremap prcmu register memory\n"); | 3158 | "failed to ioremap prcmu register memory\n"); |
3159 | return -ENOENT; | 3159 | return -ENOMEM; |
3160 | } | 3160 | } |
3161 | init_prcm_registers(); | 3161 | init_prcm_registers(); |
3162 | dbx500_fw_version_init(pdev, pdata->version_offset); | 3162 | dbx500_fw_version_init(pdev, pdata->version_offset); |
3163 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu-tcdm"); | 3163 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu-tcdm"); |
3164 | if (!res) { | 3164 | if (!res) { |
3165 | dev_err(&pdev->dev, "no prcmu tcdm region provided\n"); | 3165 | dev_err(&pdev->dev, "no prcmu tcdm region provided\n"); |
3166 | return -ENOENT; | 3166 | return -EINVAL; |
3167 | } | 3167 | } |
3168 | tcdm_base = devm_ioremap(&pdev->dev, res->start, | 3168 | tcdm_base = devm_ioremap(&pdev->dev, res->start, |
3169 | resource_size(res)); | 3169 | resource_size(res)); |
3170 | if (!tcdm_base) { | 3170 | if (!tcdm_base) { |
3171 | dev_err(&pdev->dev, | 3171 | dev_err(&pdev->dev, |
3172 | "failed to ioremap prcmu-tcdm register memory\n"); | 3172 | "failed to ioremap prcmu-tcdm register memory\n"); |
3173 | return -ENOENT; | 3173 | return -ENOMEM; |
3174 | } | 3174 | } |
3175 | 3175 | ||
3176 | /* Clean up the mailbox interrupts after pre-kernel code. */ | 3176 | /* Clean up the mailbox interrupts after pre-kernel code. */ |
@@ -3179,15 +3179,14 @@ static int db8500_prcmu_probe(struct platform_device *pdev) | |||
3179 | irq = platform_get_irq(pdev, 0); | 3179 | irq = platform_get_irq(pdev, 0); |
3180 | if (irq <= 0) { | 3180 | if (irq <= 0) { |
3181 | dev_err(&pdev->dev, "no prcmu irq provided\n"); | 3181 | dev_err(&pdev->dev, "no prcmu irq provided\n"); |
3182 | return -ENOENT; | 3182 | return irq; |
3183 | } | 3183 | } |
3184 | 3184 | ||
3185 | err = request_threaded_irq(irq, prcmu_irq_handler, | 3185 | err = request_threaded_irq(irq, prcmu_irq_handler, |
3186 | prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL); | 3186 | prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL); |
3187 | if (err < 0) { | 3187 | if (err < 0) { |
3188 | pr_err("prcmu: Failed to allocate IRQ_DB8500_PRCMU1.\n"); | 3188 | pr_err("prcmu: Failed to allocate IRQ_DB8500_PRCMU1.\n"); |
3189 | err = -EBUSY; | 3189 | return err; |
3190 | goto no_irq_return; | ||
3191 | } | 3190 | } |
3192 | 3191 | ||
3193 | db8500_irq_init(np); | 3192 | db8500_irq_init(np); |
@@ -3211,7 +3210,7 @@ static int db8500_prcmu_probe(struct platform_device *pdev) | |||
3211 | if (err) { | 3210 | if (err) { |
3212 | mfd_remove_devices(&pdev->dev); | 3211 | mfd_remove_devices(&pdev->dev); |
3213 | pr_err("prcmu: Failed to add subdevices\n"); | 3212 | pr_err("prcmu: Failed to add subdevices\n"); |
3214 | goto no_irq_return; | 3213 | return err; |
3215 | } | 3214 | } |
3216 | } | 3215 | } |
3217 | 3216 | ||
@@ -3219,12 +3218,10 @@ static int db8500_prcmu_probe(struct platform_device *pdev) | |||
3219 | if (err) { | 3218 | if (err) { |
3220 | mfd_remove_devices(&pdev->dev); | 3219 | mfd_remove_devices(&pdev->dev); |
3221 | pr_err("prcmu: Failed to add ab8500 subdevice\n"); | 3220 | pr_err("prcmu: Failed to add ab8500 subdevice\n"); |
3222 | goto no_irq_return; | 3221 | return err; |
3223 | } | 3222 | } |
3224 | 3223 | ||
3225 | pr_info("DB8500 PRCMU initialized\n"); | 3224 | pr_info("DB8500 PRCMU initialized\n"); |
3226 | |||
3227 | no_irq_return: | ||
3228 | return err; | 3225 | return err; |
3229 | } | 3226 | } |
3230 | static const struct of_device_id db8500_prcmu_match[] = { | 3227 | static const struct of_device_id db8500_prcmu_match[] = { |