serial: 8250: dw: Fix NULL pointer dereference
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Mon, 2 May 2022 11:56:21 +0000 (14:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 May 2022 20:33:36 +0000 (22:33 +0200)
dw8250_platform_data is only used on DT platforms for now.

Fixes: 4a218b277fdb ("serial: 8250: dw: Create a generic platform data structure")
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220502115621.77985-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_dw.c

index 0cf1a99..31422e4 100644 (file)
@@ -433,9 +433,9 @@ static void dw8250_prepare_rx_dma(struct uart_8250_port *p)
 static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
 {
        struct device_node *np = p->dev->of_node;
-       unsigned int quirks = data->pdata->quirks;
 
        if (np) {
+               unsigned int quirks = data->pdata->quirks;
                int id;
 
                /* get index of serial line, if found in DT aliases */