Skip to contentSkip to conversation

net/bluetooth: remove unneeded err variable

PATCH Applied [email protected] 3 participants 3 messages Jan 18, 2022 – Feb 1, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/bluetooth: remove unneeded err variable

From: Minghao Chi <[email protected]>

Return value from mgmt_cmd_complete() directly instead of taking this in another redundant variable.

---
 net/bluetooth/mgmt.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
net/bluetooth/mgmt.c +1 -4
index 37087cf7dc5a..d0804648da32 100644
@@ -8601,7 +8601,6 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
 	struct mgmt_cp_get_adv_size_info *cp = data;
 	struct mgmt_rp_get_adv_size_info rp;
 	u32 flags, supported_flags;
-	int err;
 
 	bt_dev_dbg(hdev, "sock %p", sk);
 
@@ -8628,10 +8627,8 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
 	rp.max_adv_data_len = tlv_data_max_len(hdev, flags, true);
 	rp.max_scan_rsp_len = tlv_data_max_len(hdev, flags, false);
 
-	err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
+	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
 				MGMT_STATUS_SUCCESS, &rp, sizeof(rp));
-
-	return err;
 }
 
 static const struct hci_mgmt_handler mgmt_handlers[] = {
Signature · 1 line
2.25.1
maintainer
#1 lore raw

Hi Minghao,

Quoted 2 lines

Return value from mgmt_cmd_complete() directly instead of taking this in another redundant variable.

the Bluetooth subsystem uses Bluetooth: as subject prefix.

Quoted 20 lines

---
net/bluetooth/mgmt.c | 5 +----

1 file changed, 1 insertion(+), 4 deletions(-)
net/bluetooth/mgmt.c +0 -1
index 37087cf7dc5a..d0804648da32 100644
@@ -8601,7 +8601,6 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
 	struct mgmt_cp_get_adv_size_info *cp = data;
 	struct mgmt_rp_get_adv_size_info rp;
 	u32 flags, supported_flags;
-	int err;
 
 	bt_dev_dbg(hdev, "sock %p", sk);
 

net/bluetooth/mgmt.c static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev, · line 8632

Quoted 9 lines
net/bluetooth/mgmt.c +1 -3
@@ -8628,10 +8627,8 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
 	rp.max_adv_data_len = tlv_data_max_len(hdev, flags, true);
 	rp.max_scan_rsp_len = tlv_data_max_len(hdev, flags, false);
 
-	err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
+	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
 				MGMT_STATUS_SUCCESS, &rp, sizeof(rp));
-
-	return err;
 }

You also have a coding style error here in your indentation.

Regards

Marcel

maintainer Applied
#2 lore raw

Hi,

Quoted 40 lines · Marcel Holtmann

Hi Minghao,

Quoted 2 lines

Return value from mgmt_cmd_complete() directly instead of taking this in another redundant variable.

the Bluetooth subsystem uses Bluetooth: as subject prefix.

Quoted 20 lines

---
net/bluetooth/mgmt.c | 5 +----

1 file changed, 1 insertion(+), 4 deletions(-)
net/bluetooth/mgmt.c +0 -1
index 37087cf7dc5a..d0804648da32 100644
@@ -8601,7 +8601,6 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
      struct mgmt_cp_get_adv_size_info *cp = data;
      struct mgmt_rp_get_adv_size_info rp;
      u32 flags, supported_flags;
-     int err;
 
      bt_dev_dbg(hdev, "sock %p", sk);
 

net/bluetooth/mgmt.c static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev, · line 8632

Quoted 9 lines
net/bluetooth/mgmt.c +1 -3
@@ -8628,10 +8627,8 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
      rp.max_adv_data_len = tlv_data_max_len(hdev, flags, true);
      rp.max_scan_rsp_len = tlv_data_max_len(hdev, flags, false);
 
-     err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
+     return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
                              MGMT_STATUS_SUCCESS, &rp, sizeof(rp));
-
-     return err;
 }

You also have a coding style error here in your indentation.

Quoted 3 lines

Regards

Marcel

Applied, after fixing the coding style and commit message, thanks.

Signature · 1 line
Luiz Augusto von Dentz