From: Rajat Jain <rajatja@google.com>
To: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Marcel Holtmann <marcel@holtmann.org>,
Gustavo Padovan <gustavo@padovan.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
Amitkumar Karwar <akarwar@marvell.com>,
Wei-Ning Huang <wnhuang@chromium.org>,
Xinming Hu <huxm@marvell.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-bluetooth@vger.kernel.org,
Brian Norris <briannorris@google.com>
Cc: Rajat Jain <rajatja@google.com>, rajatxjain@gmail.com
Subject: [PATCH 1/3] Bluetooth: btusb: Use an error label for error paths
Date: Wed, 14 Dec 2016 11:12:57 -0800 [thread overview]
Message-ID: <1481742779-15105-1-git-send-email-rajatja@google.com> (raw)
Use a label to remove the repetetive cleanup, for error cases.
(This label will also be used in subsequent patches).
Signed-off-by: Rajat Jain <rajatja@google.com>
---
drivers/bluetooth/btusb.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 2f633df..ce22cef 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2991,18 +2991,15 @@ static int btusb_probe(struct usb_interface *intf,
err = usb_set_interface(data->udev, 0, 0);
if (err < 0) {
BT_ERR("failed to set interface 0, alt 0 %d", err);
- hci_free_dev(hdev);
- return err;
+ goto out_free_dev;
}
}
if (data->isoc) {
err = usb_driver_claim_interface(&btusb_driver,
data->isoc, data);
- if (err < 0) {
- hci_free_dev(hdev);
- return err;
- }
+ if (err < 0)
+ goto out_free_dev;
}
#ifdef CONFIG_BT_HCIBTUSB_BCM
@@ -3016,14 +3013,16 @@ static int btusb_probe(struct usb_interface *intf,
#endif
err = hci_register_dev(hdev);
- if (err < 0) {
- hci_free_dev(hdev);
- return err;
- }
+ if (err < 0)
+ goto out_free_dev;
usb_set_intfdata(intf, data);
return 0;
+
+out_free_dev:
+ hci_free_dev(hdev);
+ return err;
}
static void btusb_disconnect(struct usb_interface *intf)
--
2.8.0.rc3.226.g39d4020
next reply other threads:[~2016-12-14 19:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 19:12 Rajat Jain [this message]
[not found] ` <1481742779-15105-1-git-send-email-rajatja-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2016-12-14 19:12 ` [PATCH 2/3] Bluetooth: btusb: Add out-of-band wakeup support Rajat Jain
[not found] ` <1481742779-15105-2-git-send-email-rajatja-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2016-12-15 3:21 ` Brian Norris
[not found] ` <20161215032105.GA88921-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2016-12-16 19:43 ` Rajat Jain
2016-12-14 19:12 ` [PATCH 3/3] Bluetooth: btusb: Configure Marvel to use one of the pins for oob wakeup Rajat Jain
[not found] ` <1481742779-15105-3-git-send-email-rajatja-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2016-12-15 8:29 ` Gregory CLEMENT
2016-12-15 18:04 ` Rajat Jain
2016-12-19 22:04 ` Rob Herring
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=1481742779-15105-1-git-send-email-rajatja@google.com \
--to=rajatja@google.com \
--cc=akarwar@marvell.com \
--cc=briannorris@google.com \
--cc=devicetree@vger.kernel.org \
--cc=gustavo@padovan.org \
--cc=huxm@marvell.com \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=rajatxjain@gmail.com \
--cc=robh+dt@kernel.org \
--cc=wnhuang@chromium.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).