From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: bp@alien8.de, mchehab@kernel.org
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH] EDAC, mv64x60: Remove some code duplication
Date: Sat, 13 Jan 2018 08:28:21 +0100 [thread overview]
Message-ID: <20180113072821.8100-1-christophe.jaillet@wanadoo.fr> (raw)
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
next reply other threads:[~2018-01-13 7:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-13 7:28 Christophe JAILLET [this message]
2018-01-13 14:22 ` [PATCH] EDAC, mv64x60: Remove some code duplication Borislav Petkov
2018-01-13 17:09 ` Christophe JAILLET
2018-01-14 22:48 ` Chris Packham
2018-01-15 22:31 ` Michael Ellerman
2018-01-16 6:19 ` Christophe JAILLET
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180113072821.8100-1-christophe.jaillet@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=bp@alien8.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).