mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-16 14:06:48 +07:00
8250_lpss: check null return when calling pci_ioremap_bar
pci_ioremap_bar may return null. This is eventually de-referenced at drivers/dma/dw/core.c:1154 and drivers/dma/dw/core.c:1168. A null check is needed to prevent null de-reference. I am adding the check and in case of failure. Thanks to Andy Shevchenko for the hint on the necessity of pci_iounmap when exiting. Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20190719174848.24216-1-navid.emamdoost@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f77ebb241c
commit
ea5ab2e422
@ -169,10 +169,12 @@ static void qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port)
|
||||
struct pci_dev *pdev = to_pci_dev(port->dev);
|
||||
int ret;
|
||||
|
||||
chip->pdata = &qrk_serial_dma_pdata;
|
||||
chip->dev = &pdev->dev;
|
||||
chip->irq = pci_irq_vector(pdev, 0);
|
||||
chip->regs = pci_ioremap_bar(pdev, 1);
|
||||
chip->pdata = &qrk_serial_dma_pdata;
|
||||
if (!chip->regs)
|
||||
return;
|
||||
|
||||
/* Falling back to PIO mode if DMA probing fails */
|
||||
ret = dw_dma_probe(chip);
|
||||
@ -195,11 +197,15 @@ static void qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port)
|
||||
|
||||
static void qrk_serial_exit_dma(struct lpss8250 *lpss)
|
||||
{
|
||||
struct dw_dma_chip *chip = &lpss->dma_chip;
|
||||
struct dw_dma_slave *param = &lpss->dma_param;
|
||||
|
||||
if (!param->dma_dev)
|
||||
return;
|
||||
dw_dma_remove(&lpss->dma_chip);
|
||||
|
||||
dw_dma_remove(chip);
|
||||
|
||||
pci_iounmap(to_pci_dev(chip->dev), chip->regs);
|
||||
}
|
||||
#else /* CONFIG_SERIAL_8250_DMA */
|
||||
static void qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port) {}
|
||||
|
Loading…
Reference in New Issue
Block a user