From 77191db5ba7bd321fbbf4315675ee774a2b5a362 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 9 Feb 2023 16:43:45 +0300 Subject: [PATCH] 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 Acked-by: Arnd Bergmann Link: https://lore.kernel.org/r/Y+T4kTcJwRwxNHJq@kili Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-plat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index cd17cca..b9f9625 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)); -- 2.7.4