Re: [PATCH] bluetooth: fix variable shadow warnings

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

 



Hi Johannes,

> Sparse points out three places where variables are shadowed,
> rename two of the variables and remove the duplicate third.
> 
> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
> ---
> net/bluetooth/hci_event.c  | 12 +++++++-----
> net/bluetooth/l2cap_sock.c |  2 +-
> 2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 94aab73..b5a3736 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1291,9 +1291,11 @@ static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status)
> 		goto unlock;
> 
> 	if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
> -		struct hci_cp_auth_requested cp;
> -		cp.handle = __cpu_to_le16(conn->handle);
> -		hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
> +		struct hci_cp_auth_requested auth_req;

can you rename this to auth_cp. The code base uses cp for command parameters.

> +
> +		auth_req.handle = __cpu_to_le16(conn->handle);
> +		hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED,
> +			     sizeof(auth_req), &auth_req);
> 	}
> 
> unlock:
> @@ -3636,8 +3638,8 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
> 	skb_pull(skb, HCI_EVENT_HDR_SIZE);
> 
> 	if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->req.event == event) {
> -		struct hci_command_hdr *hdr = (void *) hdev->sent_cmd->data;
> -		u16 opcode = __le16_to_cpu(hdr->opcode);
> +		struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data;
> +		u16 opcode = __le16_to_cpu(cmd_hdr->opcode);
> 
> 		hci_req_cmd_complete(hdev, opcode, 0);
> 	}
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index 0098af8..f07e25d 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -683,7 +683,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
> 		}
> 
> 		if (opt == BT_FLUSHABLE_OFF) {
> -			struct l2cap_conn *conn = chan->conn;
> +			conn = chan->conn;
> 			/* proceed further only when we have l2cap_conn and
> 			   No Flush support in the LM */
> 			if (!conn || !lmp_no_flush_capable(conn->hcon->hdev)) {

I would have personally put this into part into a separate patch, but this way is fine as well.

Regards

Marcel

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