Re: [PATCH 2/4] Bluetooth: HCI request error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Johan,

On Thu, Mar 7, 2013 at 4:15 AM, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote:
> Hi Andre,
>
> On Wed, Mar 06, 2013, Andre Guedes wrote:
>> @@ -1042,6 +1042,9 @@ int hci_unregister_cb(struct hci_cb *hcb);
>>  struct hci_request {
>>       struct hci_dev          *hdev;
>>       struct sk_buff_head     cmd_q;
>> +
>> +     /* This flag is set if something goes wrong during request creation */
>> +     bool                    error;
>>  };
>
> I'd prefer if you'd use "int err". That'd allow you to record the exact
> error from when it occurred and have hci_req_run return it.

I'll change this in v2.

>>  int hci_req_run(struct hci_request *req, hci_req_complete_t complete)
>> @@ -2460,6 +2461,15 @@ int hci_req_run(struct hci_request *req, hci_req_complete_t complete)
>>       if (skb_queue_empty(&req->cmd_q))
>>               return -ENODATA;
>>
>> +     /*
>> +      * If error flag is set, remove all HCI commands queued on the HCI
>> +      * request queue.
>> +      */
>> +     if (req->error) {
>> +             skb_queue_purge(&req->cmd_q);
>> +             return -EIO;
>> +     }
>
> I think this check belongs before the queue_empty check. If the first
> command failed to be added we should properly have hci_req_run fail too.
> If you do it your way e.g. hci_req_sync would just succeed even though
> there was a memory allocation error.

Fair enough. I'll fix it in v2.

Regards,

Andre
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux