Skip to content

Commit

Permalink
usb/hcd: Fix a NULL vs IS_ERR() bug in usb_hcd_setup_local_mem()
Browse files Browse the repository at this point in the history
The devm_memremap() function doesn't return NULL, it returns error
pointers.

Fixes: b0310c2 ("USB: use genalloc for USB HCs with local memory")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20190607135709.GC16718@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Jul 25, 2019
1 parent d74ffae commit 94b9a70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/core/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3052,8 +3052,8 @@ int usb_hcd_setup_local_mem(struct usb_hcd *hcd, phys_addr_t phys_addr,

local_mem = devm_memremap(hcd->self.sysdev, phys_addr,
size, MEMREMAP_WC);
if (!local_mem)
return -ENOMEM;
if (IS_ERR(local_mem))
return PTR_ERR(local_mem);

/*
* Here we pass a dma_addr_t but the arg type is a phys_addr_t.
Expand Down

0 comments on commit 94b9a70

Please sign in to comment.