diff options
author | omar ramirez <omar.ramirez@ti.com> | 2011-04-18 12:39:41 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-05-03 05:38:01 -0400 |
commit | 7529b703869d59e799a0c0eb4f3df7a418f7dc99 (patch) | |
tree | e3a75491d78a829a12e416d8bff90bb47c804575 /arch/arm/mach-omap2/omap_l3_smx.c | |
parent | 11383a9bcc213cd2b55e2aef863ef2a8b3d7b62c (diff) |
OMAP3/4: l3: fix omap3_l3_probe error path
l3_smx:
- Add missing free_irq and remove an empty goto label.
l3_noc:
- If kzalloc fails driver shouldn't continue with a NULL pointer.
- Add missing free_irq and remove empty goto labels.
- Safe to assume that if we reached the end point of execution
without errors, then return value is 0, so replacing instead
another goto.
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_l3_smx.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_l3_smx.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/arch/arm/mach-omap2/omap_l3_smx.c index 5f2da7565b68..45aaa5cb97f3 100644 --- a/arch/arm/mach-omap2/omap_l3_smx.c +++ b/arch/arm/mach-omap2/omap_l3_smx.c | |||
@@ -228,10 +228,8 @@ static int __init omap3_l3_probe(struct platform_device *pdev) | |||
228 | int ret; | 228 | int ret; |
229 | 229 | ||
230 | l3 = kzalloc(sizeof(*l3), GFP_KERNEL); | 230 | l3 = kzalloc(sizeof(*l3), GFP_KERNEL); |
231 | if (!l3) { | 231 | if (!l3) |
232 | ret = -ENOMEM; | 232 | return -ENOMEM; |
233 | goto err0; | ||
234 | } | ||
235 | 233 | ||
236 | platform_set_drvdata(pdev, l3); | 234 | platform_set_drvdata(pdev, l3); |
237 | 235 | ||
@@ -239,13 +237,13 @@ static int __init omap3_l3_probe(struct platform_device *pdev) | |||
239 | if (!res) { | 237 | if (!res) { |
240 | dev_err(&pdev->dev, "couldn't find resource\n"); | 238 | dev_err(&pdev->dev, "couldn't find resource\n"); |
241 | ret = -ENODEV; | 239 | ret = -ENODEV; |
242 | goto err1; | 240 | goto err0; |
243 | } | 241 | } |
244 | l3->rt = ioremap(res->start, resource_size(res)); | 242 | l3->rt = ioremap(res->start, resource_size(res)); |
245 | if (!(l3->rt)) { | 243 | if (!(l3->rt)) { |
246 | dev_err(&pdev->dev, "ioremap failed\n"); | 244 | dev_err(&pdev->dev, "ioremap failed\n"); |
247 | ret = -ENOMEM; | 245 | ret = -ENOMEM; |
248 | goto err2; | 246 | goto err0; |
249 | } | 247 | } |
250 | 248 | ||
251 | l3->debug_irq = platform_get_irq(pdev, 0); | 249 | l3->debug_irq = platform_get_irq(pdev, 0); |
@@ -254,7 +252,7 @@ static int __init omap3_l3_probe(struct platform_device *pdev) | |||
254 | "l3-debug-irq", l3); | 252 | "l3-debug-irq", l3); |
255 | if (ret) { | 253 | if (ret) { |
256 | dev_err(&pdev->dev, "couldn't request debug irq\n"); | 254 | dev_err(&pdev->dev, "couldn't request debug irq\n"); |
257 | goto err3; | 255 | goto err1; |
258 | } | 256 | } |
259 | 257 | ||
260 | l3->app_irq = platform_get_irq(pdev, 1); | 258 | l3->app_irq = platform_get_irq(pdev, 1); |
@@ -264,18 +262,17 @@ static int __init omap3_l3_probe(struct platform_device *pdev) | |||
264 | 262 | ||
265 | if (ret) { | 263 | if (ret) { |
266 | dev_err(&pdev->dev, "couldn't request app irq\n"); | 264 | dev_err(&pdev->dev, "couldn't request app irq\n"); |
267 | goto err4; | 265 | goto err2; |
268 | } | 266 | } |
269 | 267 | ||
270 | goto err0; | 268 | return 0; |
271 | 269 | ||
272 | err4: | ||
273 | err3: | ||
274 | iounmap(l3->rt); | ||
275 | err2: | 270 | err2: |
271 | free_irq(l3->debug_irq, l3); | ||
276 | err1: | 272 | err1: |
277 | kfree(l3); | 273 | iounmap(l3->rt); |
278 | err0: | 274 | err0: |
275 | kfree(l3); | ||
279 | return ret; | 276 | return ret; |
280 | } | 277 | } |
281 | 278 | ||