* [PATCH] mtd: davinci_nand: Remove unnecessary labels from error path
@ 2014-01-15 8:08 Prabhakar Lad
2014-01-16 21:32 ` Brian Norris
0 siblings, 1 reply; 5+ messages in thread
From: Prabhakar Lad @ 2014-01-15 8:08 UTC (permalink / raw)
To: David Woodhouse, linux-mtd; +Cc: Lad, Prabhakar, linux-kernel
From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
This patch removes the unnecessary labels from
the error path in probe function which did nothing
than just returning error values, Thus simplifying code
path and improved readability.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
drivers/mtd/nand/davinci_nand.c | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index b77a01e..3e4d457 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -609,8 +609,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
if (!info) {
dev_err(&pdev->dev, "unable to allocate memory\n");
- ret = -ENOMEM;
- goto err_nomem;
+ return -ENOMEM;
}
platform_set_drvdata(pdev, info);
@@ -619,20 +618,16 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (!res1 || !res2) {
dev_err(&pdev->dev, "resource missing\n");
- ret = -EINVAL;
- goto err_nomem;
+ return -EINVAL;
}
vaddr = devm_ioremap_resource(&pdev->dev, res1);
- if (IS_ERR(vaddr)) {
- ret = PTR_ERR(vaddr);
- goto err_ioremap;
- }
+ if (IS_ERR(vaddr))
+ return PTR_ERR(vaddr);
+
base = devm_ioremap_resource(&pdev->dev, res2);
- if (IS_ERR(base)) {
- ret = PTR_ERR(base);
- goto err_ioremap;
- }
+ if (IS_ERR(base))
+ return PTR_ERR(base);
info->dev = &pdev->dev;
info->base = base;
@@ -699,7 +694,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
spin_unlock_irq(&davinci_nand_lock);
if (ret == -EBUSY)
- goto err_ecc;
+ return ret;
info->chip.ecc.calculate = nand_davinci_calculate_4bit;
info->chip.ecc.correct = nand_davinci_correct_4bit;
@@ -715,16 +710,14 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
info->chip.ecc.strength = pdata->ecc_bits;
break;
default:
- ret = -EINVAL;
- goto err_ecc;
+ return -EINVAL;
}
info->chip.ecc.mode = ecc_mode;
info->clk = devm_clk_get(&pdev->dev, "aemif");
if (IS_ERR(info->clk)) {
- ret = PTR_ERR(info->clk);
dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret);
- goto err_clk;
+ return PTR_ERR(info->clk);
}
ret = clk_prepare_enable(info->clk);
@@ -853,10 +846,6 @@ err_clk_enable:
ecc4_busy = false;
spin_unlock_irq(&davinci_nand_lock);
-err_ecc:
-err_clk:
-err_ioremap:
-err_nomem:
return ret;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: davinci_nand: Remove unnecessary labels from error path
2014-01-15 8:08 [PATCH] mtd: davinci_nand: Remove unnecessary labels from error path Prabhakar Lad
@ 2014-01-16 21:32 ` Brian Norris
2014-01-17 5:16 ` Prabhakar Lad
0 siblings, 1 reply; 5+ messages in thread
From: Brian Norris @ 2014-01-16 21:32 UTC (permalink / raw)
To: Prabhakar Lad; +Cc: linux-mtd, David Woodhouse, linux-kernel
On Wed, Jan 15, 2014 at 01:38:26PM +0530, Prabhakar Lad wrote:
> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>
> This patch removes the unnecessary labels from
> the error path in probe function which did nothing
> than just returning error values, Thus simplifying code
> path and improved readability.
>
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
This does not apply to my branch, since some OOM messages have been
dropped. Can you rebase on l2-mtd.git (or linux-next)?
Thanks,
Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: davinci_nand: Remove unnecessary labels from error path
2014-01-16 21:32 ` Brian Norris
@ 2014-01-17 5:16 ` Prabhakar Lad
2014-01-17 7:50 ` Prabhakar Lad
0 siblings, 1 reply; 5+ messages in thread
From: Prabhakar Lad @ 2014-01-17 5:16 UTC (permalink / raw)
To: Brian Norris; +Cc: linux-mtd, David Woodhouse, LKML
Hi Brian,
On Fri, Jan 17, 2014 at 3:02 AM, Brian Norris
<computersforpeace@gmail.com> wrote:
> On Wed, Jan 15, 2014 at 01:38:26PM +0530, Prabhakar Lad wrote:
>> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>>
>> This patch removes the unnecessary labels from
>> the error path in probe function which did nothing
>> than just returning error values, Thus simplifying code
>> path and improved readability.
>>
>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>
> This does not apply to my branch, since some OOM messages have been
> dropped. Can you rebase on l2-mtd.git (or linux-next)?
>
OK I'll rebase it against linux-next and post a v2.
Thanks,
--Prabhakar Lad
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: davinci_nand: Remove unnecessary labels from error path
2014-01-17 5:16 ` Prabhakar Lad
@ 2014-01-17 7:50 ` Prabhakar Lad
2014-01-20 19:54 ` Brian Norris
0 siblings, 1 reply; 5+ messages in thread
From: Prabhakar Lad @ 2014-01-17 7:50 UTC (permalink / raw)
To: Brian Norris; +Cc: linux-mtd, David Woodhouse, LKML
Hi Brain,
On Fri, Jan 17, 2014 at 10:46 AM, Prabhakar Lad
<prabhakar.csengg@gmail.com> wrote:
> Hi Brian,
>
> On Fri, Jan 17, 2014 at 3:02 AM, Brian Norris
> <computersforpeace@gmail.com> wrote:
>> On Wed, Jan 15, 2014 at 01:38:26PM +0530, Prabhakar Lad wrote:
>>> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>>>
>>> This patch removes the unnecessary labels from
>>> the error path in probe function which did nothing
>>> than just returning error values, Thus simplifying code
>>> path and improved readability.
>>>
>>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>>
>> This does not apply to my branch, since some OOM messages have been
>> dropped. Can you rebase on l2-mtd.git (or linux-next)?
>>
> OK I'll rebase it against linux-next and post a v2.
>
My Bad was too late, there is already a patch fixing the above issue
in linux-next
please ignore this patch.
Thanks,
--Prabhakar Lad
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: davinci_nand: Remove unnecessary labels from error path
2014-01-17 7:50 ` Prabhakar Lad
@ 2014-01-20 19:54 ` Brian Norris
0 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2014-01-20 19:54 UTC (permalink / raw)
To: Prabhakar Lad; +Cc: linux-mtd, David Woodhouse, LKML
On Fri, Jan 17, 2014 at 01:20:36PM +0530, Prabhakar Lad wrote:
> On Fri, Jan 17, 2014 at 10:46 AM, Prabhakar Lad
> <prabhakar.csengg@gmail.com> wrote:
> > On Fri, Jan 17, 2014 at 3:02 AM, Brian Norris
> > <computersforpeace@gmail.com> wrote:
> >> On Wed, Jan 15, 2014 at 01:38:26PM +0530, Prabhakar Lad wrote:
> >>> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> >>>
> >>> This patch removes the unnecessary labels from
> >>> the error path in probe function which did nothing
> >>> than just returning error values, Thus simplifying code
> >>> path and improved readability.
> >>>
> >>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> >>
> >> This does not apply to my branch, since some OOM messages have been
> >> dropped. Can you rebase on l2-mtd.git (or linux-next)?
> >>
> > OK I'll rebase it against linux-next and post a v2.
> >
> My Bad was too late, there is already a patch fixing the above issue
> in linux-next
Ah, and my bad on remembering; I thought this looked familiar! :)
> please ignore this patch.
Sure.
Thanks,
Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-20 19:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-15 8:08 [PATCH] mtd: davinci_nand: Remove unnecessary labels from error path Prabhakar Lad
2014-01-16 21:32 ` Brian Norris
2014-01-17 5:16 ` Prabhakar Lad
2014-01-17 7:50 ` Prabhakar Lad
2014-01-20 19:54 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox