HID: fix a potential bug in pointer casting