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>,
linux-kernel@vger.kernel.org
Cc: Rajat Jain <rajatja@google.com>, rajatxjain@gmail.com
Subject: [PATCH v5 1/3] Bluetooth: btusb: Use an error label for error paths
Date: Thu, 12 Jan 2017 10:01:05 -0800 [thread overview]
Message-ID: <20170112180107.63244-1-rajatja@google.com> (raw)
Use a label to remove the repetetive cleanup, for error cases.
Signed-off-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
---
v5: same as v4
v4: same as v3
v3: Added Brian's "Reviewed-by"
v2: same as v1
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 2f633df9f4e6..ce22cefceed1 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.11.0.390.gc69c2f50cf-goog
next reply other threads:[~2017-01-12 18:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 18:01 Rajat Jain [this message]
2017-01-12 18:01 ` [PATCH v5 2/3] Bluetooth: btusb: Add out-of-band wakeup support Rajat Jain
2017-01-24 21:20 ` Brian Norris
2017-01-12 18:01 ` [PATCH v5 3/3] Bluetooth: btusb: Configure Marvell to use one of the pins for oob wakeup Rajat Jain
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=20170112180107.63244-1-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=linux-kernel@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).