Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c701bd6 authored by Akash Asthana's avatar Akash Asthana Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
Signed-off-by: default avatarAkash Asthana <akashast@codeaurora.org>
parent 1b85a986
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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);