* [PATCH] Bluetooth: bfusb: Fix error path on firmware load
@ 2011-10-26 9:22 David Herrmann
2011-10-26 13:46 ` Marcel Holtmann
2011-10-31 19:55 ` Gustavo Padovan
0 siblings, 2 replies; 3+ messages in thread
From: David Herrmann @ 2011-10-26 9:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: padovan, marcel, David Herrmann
When loading the usb-configuration we do not signal the end of configuration on
memory allocation error. This patch moves the memory allocation to the top so
every error path uses "goto error" now to correctly send the usb-ctrl message
when detecting some error.
This also replaces GFP_ATOMIC with GFP_KERNEL as we are allowed to sleep here.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
---
drivers/bluetooth/bfusb.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 6580d50..a936763 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -568,22 +568,23 @@ static int bfusb_load_firmware(struct bfusb_data *data,
BT_INFO("BlueFRITZ! USB loading firmware");
+ buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_KERNEL);
+ if (!buf) {
+ BT_ERR("Can't allocate memory chunk for firmware");
+ return -ENOMEM;
+ }
+
pipe = usb_sndctrlpipe(data->udev, 0);
if (usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION,
0, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT) < 0) {
BT_ERR("Can't change to loading configuration");
+ kfree(buf);
return -EBUSY;
}
data->udev->toggle[0] = data->udev->toggle[1] = 0;
- buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC);
- if (!buf) {
- BT_ERR("Can't allocate memory chunk for firmware");
- return -ENOMEM;
- }
-
pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep);
while (count) {
--
1.7.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: bfusb: Fix error path on firmware load
2011-10-26 9:22 [PATCH] Bluetooth: bfusb: Fix error path on firmware load David Herrmann
@ 2011-10-26 13:46 ` Marcel Holtmann
2011-10-31 19:55 ` Gustavo Padovan
1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2011-10-26 13:46 UTC (permalink / raw)
To: David Herrmann; +Cc: linux-bluetooth, padovan
Hi David,
> When loading the usb-configuration we do not signal the end of configuration on
> memory allocation error. This patch moves the memory allocation to the top so
> every error path uses "goto error" now to correctly send the usb-ctrl message
> when detecting some error.
>
> This also replaces GFP_ATOMIC with GFP_KERNEL as we are allowed to sleep here.
>
> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
> ---
> drivers/bluetooth/bfusb.c | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: bfusb: Fix error path on firmware load
2011-10-26 9:22 [PATCH] Bluetooth: bfusb: Fix error path on firmware load David Herrmann
2011-10-26 13:46 ` Marcel Holtmann
@ 2011-10-31 19:55 ` Gustavo Padovan
1 sibling, 0 replies; 3+ messages in thread
From: Gustavo Padovan @ 2011-10-31 19:55 UTC (permalink / raw)
To: David Herrmann; +Cc: linux-bluetooth, marcel
Hi David,
* David Herrmann <dh.herrmann@googlemail.com> [2011-10-26 11:22:46 +0200]:
> When loading the usb-configuration we do not signal the end of configuration on
> memory allocation error. This patch moves the memory allocation to the top so
> every error path uses "goto error" now to correctly send the usb-ctrl message
> when detecting some error.
>
> This also replaces GFP_ATOMIC with GFP_KERNEL as we are allowed to sleep here.
>
> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
> ---
> drivers/bluetooth/bfusb.c | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
Applied, thanks.
Gustavo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-31 19:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-26 9:22 [PATCH] Bluetooth: bfusb: Fix error path on firmware load David Herrmann
2011-10-26 13:46 ` Marcel Holtmann
2011-10-31 19:55 ` Gustavo Padovan
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).