From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-pcmcia@lists.infradead.org
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] pcmcia/vrc4171: Use common error handling code in vrc4171_card_init()
Date: Mon, 30 Oct 2017 14:11:01 +0100 [thread overview]
Message-ID: <c6a55205-0d89-fbd6-3161-5d68a6645a47@users.sourceforge.net> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 30 Oct 2017 14:05:35 +0100
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pcmcia/vrc4171_card.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
index 1e5fa211fb70..56d39585ac9a 100644
--- a/drivers/pcmcia/vrc4171_card.c
+++ b/drivers/pcmcia/vrc4171_card.c
@@ -721,10 +721,8 @@ static int vrc4171_card_init(void)
return retval;
retval = platform_device_register(&vrc4171_card_device);
- if (retval < 0) {
- platform_driver_unregister(&vrc4171_card_driver);
- return retval;
- }
+ if (retval < 0)
+ goto unregister_driver;
vrc4171_set_multifunction_pin(vrc4171_slotb);
@@ -736,14 +734,17 @@ static int vrc4171_card_init(void)
if (retval < 0) {
vrc4171_remove_sockets();
platform_device_unregister(&vrc4171_card_device);
- platform_driver_unregister(&vrc4171_card_driver);
- return retval;
+ goto unregister_driver;
}
printk(KERN_INFO "%s, connected to IRQ %d\n",
vrc4171_card_driver.driver.name, vrc4171_irq);
return 0;
+
+unregister_driver:
+ platform_driver_unregister(&vrc4171_card_driver);
+ return retval;
}
static void vrc4171_card_exit(void)
--
2.14.3
reply other threads:[~2017-10-30 13:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=c6a55205-0d89-fbd6-3161-5d68a6645a47@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pcmcia@lists.infradead.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
all inboxes | Powered by JetHome®