lkml.org 
[lkml]   [2018]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] EDAC, mv64x60: Remove some code duplication
Date
Reorder the error handling code in order to release the resources in
reverse order than allocation.

Introduce a new 'release_group' label in the error handling path and use
it to void some code duplication.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/edac/mv64x60_edac.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/mv64x60_edac.c b/drivers/edac/mv64x60_edac.c
index 3c68bb525d5d..aa5bc1d8f424 100644
--- a/drivers/edac/mv64x60_edac.c
+++ b/drivers/edac/mv64x60_edac.c
@@ -450,8 +450,8 @@ static int mv64x60_cpu_err_probe(struct platform_device *pdev)
"cpu", 1, NULL, 0, 0, NULL, 0,
edac_dev_idx);
if (!edac_dev) {
- devres_release_group(&pdev->dev, mv64x60_cpu_err_probe);
- return -ENOMEM;
+ res = -ENOMEM;
+ goto release_group;
}

pdata = edac_dev->pvt_info;
@@ -561,8 +561,9 @@ static int mv64x60_cpu_err_probe(struct platform_device *pdev)
err2:
edac_device_del_device(&pdev->dev);
err:
- devres_release_group(&pdev->dev, mv64x60_cpu_err_probe);
edac_device_free_ctl_info(edac_dev);
+release_group:
+ devres_release_group(&pdev->dev, mv64x60_cpu_err_probe);
return res;
}

--
2.14.1
\
 
 \ /
  Last update: 2018-01-14 23:26    [W:0.061 / U:1.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site