Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250_dw: Call dw8250_quirks() conditionally

Not all the cases provide the driver data, that is represented by
an object instance of struct dw8250_platform_data. Id est the change
missed the case when the driver is instantiated via board files as
pure platform driver. Fix this by calling dw8250_quirks() conditionally.
This will require splitting dw8250_setup_dma_filter() out of dw8250_quirks().
Also make sure IRQ handler won't crash, it also requires driver data
to be present.

Fixes: bfd3d4a40f39 ("serial: 8250_dw: Drop unneeded NULL checks in dw8250_quirks()")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202502121529.f7e65d49-lkp@intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250212115952.2312444-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
c213375e 22a6984c

+21 -15
+21 -15
drivers/tty/serial/8250/8250_dw.c
··· 421 421 return param == chan->device->dev; 422 422 } 423 423 424 + static void dw8250_setup_dma_filter(struct uart_port *p, struct dw8250_data *data) 425 + { 426 + /* Platforms with iDMA 64-bit */ 427 + if (platform_get_resource_byname(to_platform_device(p->dev), IORESOURCE_MEM, "lpss_priv")) { 428 + data->data.dma.rx_param = p->dev->parent; 429 + data->data.dma.tx_param = p->dev->parent; 430 + data->data.dma.fn = dw8250_idma_filter; 431 + } else { 432 + data->data.dma.fn = dw8250_fallback_dma_filter; 433 + } 434 + } 435 + 424 436 static u32 dw8250_rzn1_get_dmacr_burst(int max_burst) 425 437 { 426 438 if (max_burst >= 8) ··· 503 491 p->serial_in = dw8250_serial_in32; 504 492 data->uart_16550_compatible = true; 505 493 } 506 - 507 - /* Platforms with iDMA 64-bit */ 508 - if (platform_get_resource_byname(to_platform_device(p->dev), 509 - IORESOURCE_MEM, "lpss_priv")) { 510 - data->data.dma.rx_param = p->dev->parent; 511 - data->data.dma.tx_param = p->dev->parent; 512 - data->data.dma.fn = dw8250_idma_filter; 513 - } 514 494 } 515 495 516 496 static void dw8250_reset_control_assert(void *data) ··· 524 520 return dev_err_probe(dev, -EINVAL, "no registers defined\n"); 525 521 526 522 spin_lock_init(&p->lock); 527 - p->handle_irq = dw8250_handle_irq; 528 523 p->pm = dw8250_do_pm; 529 524 p->type = PORT_8250; 530 525 p->flags = UPF_FIXED_PORT; ··· 535 532 if (!data) 536 533 return -ENOMEM; 537 534 538 - data->data.dma.fn = dw8250_fallback_dma_filter; 539 - data->pdata = device_get_match_data(p->dev); 540 535 p->private_data = &data->data; 541 - 542 - data->uart_16550_compatible = device_property_read_bool(dev, 543 - "snps,uart-16550-compatible"); 544 536 545 537 p->mapbase = regs->start; 546 538 p->mapsize = resource_size(regs); ··· 624 626 if (err) 625 627 return err; 626 628 627 - dw8250_quirks(p, data); 629 + data->uart_16550_compatible = device_property_read_bool(dev, "snps,uart-16550-compatible"); 630 + 631 + data->pdata = device_get_match_data(p->dev); 632 + if (data->pdata) 633 + dw8250_quirks(p, data); 628 634 629 635 /* If the Busy Functionality is not implemented, don't handle it */ 630 636 if (data->uart_16550_compatible) 631 637 p->handle_irq = NULL; 638 + else if (data->pdata) 639 + p->handle_irq = dw8250_handle_irq; 640 + 641 + dw8250_setup_dma_filter(p, data); 632 642 633 643 if (!data->skip_autocfg) 634 644 dw8250_setup_port(p);