diff options
author | Dan Carpenter <error27@gmail.com> | 2023-02-09 14:43:45 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-14 14:22:57 +0100 |
commit | 77191db5ba7bd321fbbf4315675ee774a2b5a362 (patch) | |
tree | 34a0a376f5584eebffbe7831b4993bab7205d55b /drivers/usb | |
parent | Merge 6.2-rc8 into usb-next (diff) | |
download | linux-77191db5ba7bd321fbbf4315675ee774a2b5a362.tar.xz linux-77191db5ba7bd321fbbf4315675ee774a2b5a362.zip |
xhci: host: potential NULL dereference in xhci_generic_plat_probe()
It's possible to exit the loop with "sysdev" set to NULL. In that
case we should use "&pdev->dev".
Fixes: ec5499d338ec ("xhci: split out rcar/rz support from xhci-plat.c")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/Y+T4kTcJwRwxNHJq@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/xhci-plat.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index cd17ccab6e00..b9f9625467d6 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -368,6 +368,9 @@ static int xhci_generic_plat_probe(struct platform_device *pdev) #endif } + if (!sysdev) + sysdev = &pdev->dev; + if (WARN_ON(!sysdev->dma_mask)) { /* Platform did not initialize dma_mask */ ret = dma_coerce_mask_and_coherent(sysdev, DMA_BIT_MASK(64)); |