serial: msm-geni-serial: Fix possible null pointer access with handle_rx

Some customers are using UART node in UFFI for console and using
the same node for HSUART in kernel but not as console. In this
scenario there is a possibility for null pointer access
with handle_rx while trying to stop secondary sequencer.
This change will move handle_rx initialization from port_startup to
probe function. This will help to avoid null pointer access issues.

Change-Id: Ibda592b375d14ba0c23c4b99223006b1fa53c211
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
Signed-off-by: Akash Asthana <akashast@codeaurora.org>
This commit is contained in:
Akash Asthana 2020-06-17 10:51:01 +05:30 committed by Gerrit - the friendly Code Review server
parent 1b85a9865b
commit 1c701bd680

View File

@ -2127,10 +2127,6 @@ static int msm_geni_serial_port_setup(struct uart_port *uport)
SE_GENI_RX_PACKING_CFG0);
geni_write_reg_nolog(cfg1, uport->membase,
SE_GENI_RX_PACKING_CFG1);
msm_port->handle_rx = handle_rx_hs;
msm_port->rx_fifo = devm_kzalloc(uport->dev,
sizeof(msm_port->rx_fifo_depth * sizeof(u32)),
GFP_KERNEL);
if (!msm_port->rx_fifo) {
ret = -ENOMEM;
goto exit_portsetup;
@ -3062,6 +3058,10 @@ static int msm_geni_serial_probe(struct platform_device *pdev)
dev_port->rx_fifo = devm_kzalloc(uport->dev, sizeof(u32),
GFP_KERNEL);
} else {
dev_port->handle_rx = handle_rx_hs;
dev_port->rx_fifo = devm_kzalloc(uport->dev,
sizeof(dev_port->rx_fifo_depth * sizeof(u32)),
GFP_KERNEL);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 150);
pm_runtime_use_autosuspend(&pdev->dev);