Skip to content

Commit

Permalink
usb: roles: Fix return value check in intel_xhci_usb_probe()
Browse files Browse the repository at this point in the history
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: f6fb9ec ("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>
  • Loading branch information
Wei Yongjun authored and Greg Kroah-Hartman committed Mar 26, 2018
1 parent 7fafcfd commit 97eba32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/roles/intel-xhci-usb-role-switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 97eba32

Please sign in to comment.