diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-03-26 08:43:57 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-26 11:59:25 +0200 |
commit | 97eba3260e7c4e65e1c085301c2330110bd6aa2b (patch) | |
tree | d1b4d8c1aa578664bbf83c8fe91dd11b28f33f47 | |
parent | USB: gadget: f_midi: fixing a possible double-free in f_midi (diff) | |
download | linux-97eba3260e7c4e65e1c085301c2330110bd6aa2b.tar.xz linux-97eba3260e7c4e65e1c085301c2330110bd6aa2b.zip |
usb: roles: Fix return value check in intel_xhci_usb_probe()
In case of error, the function devm_ioremap_nocache() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.
Fixes: f6fb9ec02be1 ("usb: roles: Add Intel xHCI USB role switch driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/roles/intel-xhci-usb-role-switch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/roles/intel-xhci-usb-role-switch.c b/drivers/usb/roles/intel-xhci-usb-role-switch.c index 58c1b60a33c1..de72eedb762e 100644 --- a/drivers/usb/roles/intel-xhci-usb-role-switch.c +++ b/drivers/usb/roles/intel-xhci-usb-role-switch.c @@ -145,8 +145,8 @@ static int intel_xhci_usb_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); data->base = devm_ioremap_nocache(dev, res->start, resource_size(res)); - if (IS_ERR(data->base)) - return PTR_ERR(data->base); + if (!data->base) + return -ENOMEM; for (i = 0; i < ARRAY_SIZE(allow_userspace_ctrl_ids); i++) if (acpi_dev_present(allow_userspace_ctrl_ids[i].hid, "1", |