Re: [PATCH] Bluetooth: Do not use assignments in IF conditions

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

 



Hi Andrei,

On Mon, Jan 10, 2011 at 11:12 AM, Emeltchenko Andrei
<Andrei.Emeltchenko.news@xxxxxxxxx> wrote:
> @@ -224,7 +226,8 @@ static void cmtp_process_transmit(struct cmtp_session *session)
>        while ((skb = skb_dequeue(&session->transmit))) {
>                struct cmtp_scb *scb = (void *) skb->cb;
>
> -               if ((tail = (session->mtu - nskb->len)) < 5) {
> +               tail = (session->mtu - nskb->len);

You can drop the parenthesis above.

> +               if (tail < 5) {
>                        cmtp_send_frame(session, nskb->data, nskb->len);
>                        skb_trim(nskb, 0);
>                        tail = session->mtu;

> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> index c791fcd..3f080fa 100644
> --- a/net/bluetooth/l2cap.c
> +++ b/net/bluetooth/l2cap.c
> @@ -4692,7 +4692,11 @@ static int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 fl
>  {
>        struct l2cap_conn *conn = hcon->l2cap_data;
>
> -       if (!conn && !(conn = l2cap_conn_add(hcon, 0)))
> +       if (!conn)
> +               goto drop;
> +
> +       conn = l2cap_conn_add(hcon, 0);
> +       if (!conn)
>                goto drop;

I think the logic has been changed here. If hcon->l2cap_data is NULL,
it should try  l2cap_conn_add(hcon, 0), and if that fails, it goes to
drop. E.g.:

###
if (!conn)
     conn = l2cap_conn_add(hcon, 0);

if (!conn)
    goto drop;
###

Regards,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil
--
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