[PATCH v2] Bluetooth: Use EIO code to report HCI error to userpace

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

 



It is not possible to distinguish in cmd_status if error was from kernel or
from HCI (because HCI status codes and kernel error codes overlaps). Since
in mgmt only kernel sends HCI commands HCI errors shouldn't be needed for
userspace at all so report EIO to userspace on HCI error.

Signed-off-by: Szymon Janc <szymon.janc@xxxxxxxxx>
---
 net/bluetooth/mgmt.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index aee1da6..dee82fe 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1372,8 +1372,7 @@ int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status)
 		return -ENOENT;
 
 	if (status != 0)
-		err = cmd_status(cmd->sk, MGMT_OP_PIN_CODE_REPLY, status, NULL,
-									0);
+		err = cmd_status(cmd->sk, MGMT_OP_PIN_CODE_REPLY, EIO, NULL, 0);
 	else
 		err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_REPLY,
 						bdaddr, sizeof(*bdaddr));
@@ -1394,8 +1393,8 @@ int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status)
 		return -ENOENT;
 
 	if (status != 0)
-		err = cmd_status(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY, status,
-								NULL, 0);
+		err = cmd_status(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY, EIO, NULL,
+									0);
 	else
 		err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY,
 						bdaddr, sizeof(*bdaddr));
-- 
1.7.0.4

--
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