aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb-hid.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2015-01-21 15:12:40 -0500
committerBill Meier <wmeier@newsguy.com>2015-01-21 21:08:31 +0000
commit067196567967cc1398283ed2723131757c105131 (patch)
treebcd257b3f312cec7b5779784c496ba5bd73e0efd /epan/dissectors/packet-usb-hid.c
parent32ab59f8e90317ed644fff37379fd4a76e1a9dae (diff)
usb-hid: fix 2 minor bugs and some dead initializers
One bug was introduced in g4d58904 Change-Id: I16a5e83f11f48038945e957c7e6ce9d50b4aec46 Reviewed-on: https://code.wireshark.org/review/6721 Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan/dissectors/packet-usb-hid.c')
-rw-r--r--epan/dissectors/packet-usb-hid.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/epan/dissectors/packet-usb-hid.c b/epan/dissectors/packet-usb-hid.c
index 5e1c594f68..722c353a43 100644
--- a/epan/dissectors/packet-usb-hid.c
+++ b/epan/dissectors/packet-usb-hid.c
@@ -461,8 +461,8 @@ dissect_usb_hid_report_localitem_data(packet_info *pinfo _U_, proto_tree *tree,
static int
dissect_usb_hid_report_item(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset, usb_conv_info_t *usb_conv_info _U_, const struct usb_hid_global_state *global)
{
- proto_item *subitem=NULL;
- proto_tree *tree=NULL, *subtree=NULL;
+ proto_item *subitem;
+ proto_tree *tree, *subtree;
int old_offset;
unsigned int tmp;
unsigned int bSize, bType, bTag;
@@ -501,7 +501,7 @@ dissect_usb_hid_report_item(packet_info *pinfo _U_, proto_tree *parent_tree, tvb
}
subtree = proto_tree_add_subtree_format(parent_tree, tvb, offset, bSize + 1,
- ett_usb_hid_item_header, NULL, "%s item (%s)",
+ ett_usb_hid_item_header, &subitem, "%s item (%s)",
val_to_str(bType, usb_hid_item_bType_vals, "Unknown/%u"),
val_to_str(bTag, usb_hid_cur_bTag_vals, "Unknown/%u tag")
);
@@ -557,21 +557,19 @@ dissect_usb_hid_report_item(packet_info *pinfo _U_, proto_tree *parent_tree, tvb
int
dissect_usb_hid_get_report_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset, usb_conv_info_t *usb_conv_info)
{
- proto_item *item=NULL;
- proto_tree *tree=NULL;
+ proto_item *item;
+ proto_tree *tree;
int old_offset=offset;
struct usb_hid_global_state initial_global;
memset(&initial_global, 0, sizeof(struct usb_hid_global_state));
- if (parent_tree) {
- item = proto_tree_add_protocol_format(parent_tree, proto_usb_hid, tvb, offset,
- -1, "HID Report");
- tree = proto_item_add_subtree(item, ett_usb_hid_report);
- offset = dissect_usb_hid_report_item(pinfo, tree, tvb, offset, usb_conv_info, &initial_global);
+ item = proto_tree_add_protocol_format(parent_tree, proto_usb_hid, tvb, offset,
+ -1, "HID Report");
+ tree = proto_item_add_subtree(item, ett_usb_hid_report);
+ offset = dissect_usb_hid_report_item(pinfo, tree, tvb, offset, usb_conv_info, &initial_global);
- proto_item_set_len(item, offset-old_offset);
- }
+ proto_item_set_len(item, offset-old_offset);
return offset;
}