* [PATCH] Bluetooth: Remove unnecessary 'send' parameter from smp_failure()
@ 2013-11-06 9:24 johan.hedberg
2013-11-06 13:31 ` Anderson Lizardo
2013-11-06 20:17 ` Marcel Holtmann
0 siblings, 2 replies; 5+ messages in thread
From: johan.hedberg @ 2013-11-06 9:24 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
The send parameter has only been used for determining whether to send a
Pairing Failed PDU or not. However, the function can equally well use
the already existing reason parameter to make this choice and send the
PDU whenever a non-zero value was passed.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/smp.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 4b07acb8293c..f99352d1aa43 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -257,11 +257,11 @@ static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size)
return 0;
}
-static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send)
+static void smp_failure(struct l2cap_conn *conn, u8 reason)
{
struct hci_conn *hcon = conn->hcon;
- if (send)
+ if (reason)
smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason),
&reason);
@@ -406,7 +406,7 @@ static void confirm_work(struct work_struct *work)
return;
error:
- smp_failure(conn, reason, 1);
+ smp_failure(conn, reason);
}
static void random_work(struct work_struct *work)
@@ -490,7 +490,7 @@ static void random_work(struct work_struct *work)
return;
error:
- smp_failure(conn, reason, 1);
+ smp_failure(conn, reason);
}
static struct smp_chan *smp_chan_create(struct l2cap_conn *conn)
@@ -555,10 +555,10 @@ int smp_user_confirm_reply(struct hci_conn *hcon, u16 mgmt_op, __le32 passkey)
break;
case MGMT_OP_USER_PASSKEY_NEG_REPLY:
case MGMT_OP_USER_CONFIRM_NEG_REPLY:
- smp_failure(conn, SMP_PASSKEY_ENTRY_FAILED, 1);
+ smp_failure(conn, SMP_PASSKEY_ENTRY_FAILED);
return 0;
default:
- smp_failure(conn, SMP_PASSKEY_ENTRY_FAILED, 1);
+ smp_failure(conn, SMP_PASSKEY_ENTRY_FAILED);
return -EOPNOTSUPP;
}
@@ -895,7 +895,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
break;
case SMP_CMD_PAIRING_FAIL:
- smp_failure(conn, skb->data[0], 0);
+ smp_failure(conn, 0);
reason = 0;
err = -EPERM;
break;
@@ -941,7 +941,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
done:
if (reason)
- smp_failure(conn, reason, 1);
+ smp_failure(conn, reason);
kfree_skb(skb);
return err;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] Bluetooth: Remove unnecessary 'send' parameter from smp_failure()
2013-11-06 9:24 [PATCH] Bluetooth: Remove unnecessary 'send' parameter from smp_failure() johan.hedberg
@ 2013-11-06 13:31 ` Anderson Lizardo
2013-11-06 13:32 ` Anderson Lizardo
2013-11-06 20:17 ` Marcel Holtmann
1 sibling, 1 reply; 5+ messages in thread
From: Anderson Lizardo @ 2013-11-06 13:31 UTC (permalink / raw)
To: Johan Hedberg; +Cc: BlueZ development
Hi Johan,
On Wed, Nov 6, 2013 at 5:24 AM, <johan.hedberg@gmail.com> wrote:
> @@ -895,7 +895,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
> break;
>
> case SMP_CMD_PAIRING_FAIL:
> - smp_failure(conn, skb->data[0], 0);
> + smp_failure(conn, 0);
I think you meant "smp_failure(conn, skb->data[0]);" here.
> reason = 0;
> err = -EPERM;
> break;
Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Remove unnecessary 'send' parameter from smp_failure()
2013-11-06 13:31 ` Anderson Lizardo
@ 2013-11-06 13:32 ` Anderson Lizardo
2013-11-06 13:44 ` Johan Hedberg
0 siblings, 1 reply; 5+ messages in thread
From: Anderson Lizardo @ 2013-11-06 13:32 UTC (permalink / raw)
To: Johan Hedberg; +Cc: BlueZ development
Hi again,
On Wed, Nov 6, 2013 at 9:31 AM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Hi Johan,
>
> On Wed, Nov 6, 2013 at 5:24 AM, <johan.hedberg@gmail.com> wrote:
>
>> @@ -895,7 +895,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
>> break;
>>
>> case SMP_CMD_PAIRING_FAIL:
>> - smp_failure(conn, skb->data[0], 0);
>> + smp_failure(conn, 0);
>
> I think you meant "smp_failure(conn, skb->data[0]);" here.
My bad, I see now that the purpose is to not send an error in this case.
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Remove unnecessary 'send' parameter from smp_failure()
2013-11-06 13:32 ` Anderson Lizardo
@ 2013-11-06 13:44 ` Johan Hedberg
0 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2013-11-06 13:44 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: BlueZ development
Hi Lizardo,
On Wed, Nov 06, 2013, Anderson Lizardo wrote:
> On Wed, Nov 6, 2013 at 9:31 AM, Anderson Lizardo
> <anderson.lizardo@openbossa.org> wrote:
> > Hi Johan,
> >
> > On Wed, Nov 6, 2013 at 5:24 AM, <johan.hedberg@gmail.com> wrote:
> >
> >> @@ -895,7 +895,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
> >> break;
> >>
> >> case SMP_CMD_PAIRING_FAIL:
> >> - smp_failure(conn, skb->data[0], 0);
> >> + smp_failure(conn, 0);
> >
> > I think you meant "smp_failure(conn, skb->data[0]);" here.
>
> My bad, I see now that the purpose is to not send an error in this case.
Exactly. Which is why the original code was misleading in that you might
have thought it actually did something with skb->data[0].
Johan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Remove unnecessary 'send' parameter from smp_failure()
2013-11-06 9:24 [PATCH] Bluetooth: Remove unnecessary 'send' parameter from smp_failure() johan.hedberg
2013-11-06 13:31 ` Anderson Lizardo
@ 2013-11-06 20:17 ` Marcel Holtmann
1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2013-11-06 20:17 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth@vger.kernel.org development
Hi Johan,
> The send parameter has only been used for determining whether to send a
> Pairing Failed PDU or not. However, the function can equally well use
> the already existing reason parameter to make this choice and send the
> PDU whenever a non-zero value was passed.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/smp.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-06 20:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-06 9:24 [PATCH] Bluetooth: Remove unnecessary 'send' parameter from smp_failure() johan.hedberg
2013-11-06 13:31 ` Anderson Lizardo
2013-11-06 13:32 ` Anderson Lizardo
2013-11-06 13:44 ` Johan Hedberg
2013-11-06 20:17 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox