hcd-xhci: check & correct param before using it
commit20729dbd0109b9d9065447dba354f10bcf78d0d6
authorCao jin <caoj.fnst@cn.fujitsu.com>
Tue, 17 Jan 2017 06:18:47 +0000 (17 14:18 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 1 Feb 2017 01:37:18 +0000 (1 03:37 +0200)
tree0af24b17a30a346c706327b14822468de410df58
parent9348243687930bc54aa76d887dabb622922ea09f
hcd-xhci: check & correct param before using it

usb_xhci_realize() corrects invalid values of property "intrs"
automatically, but the uncorrected value is passed to msi_init(),
which chokes on invalid values.  Delay that until after the
correction.

Resources allocated by usb_xhci_init() are leaked when msi_init()
fails.  Fix by calling it after msi_init().

CC: Gerd Hoffmann <kraxel@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
CC: Marcel Apfelbaum <marcel@redhat.com>
CC: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/usb/hcd-xhci.c