[PATCH v3 1/4] bluetooth: ofono: Use Acquire method if available

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

 



On Thu, 2018-03-22 at 14:56 +0200, Luiz Augusto von Dentz wrote:
> +static int card_connect(struct hf_audio_card *card) {
> +    DBusMessage *r;
> +    DBusError err;
> +
> +    if (card->connecting)
> +        return -EAGAIN;
> +
> +    card->connecting = true;
> +
> +    dbus_error_init(&err);
> +    r = card_send(card, "Connect", &err);
> +
> +    if (!r) {
> +        pa_log_error("Failed to connect %s: %s", err.name, err.message);
> +        card->connecting = false;
> +        dbus_error_free(&err);
> +        return -1;
> +    }
> +
> +    dbus_message_unref(r);
> +
> +    if (card->connecting)
> +        return -EAGAIN;

card->connecting is always true here, so using "if (card->connecting)"
here doesn't make sense. This was true for the old code as well, and I
suppose the code works fine, so I'll apply this patch anyway, but it
would be nice to get a patch for removing the if check and adding a
comment about why we return -EAGAIN (I guess the reason is that we
haven't received the fd yet at this point and we're waiting for the
NewConnection signal).

-- 
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux