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

Commit cb9e2e00 authored by Venkata Rao Kakani's avatar Venkata Rao Kakani
Browse files

drivers: uart: initialize spin_lock before use



In linux guest restart case, during probe, stop_rx_sequencer is
getting called because of residual state set before restart.

spin_lock which is used in stop_rx_sequencer is not initialized.
To, resolve spin_lock debug mentioned below, initialize spin_lock
early.

		spin_dump+0x84/0x88
		do_raw_spin_lock+0xd4/0x12c
		raw_spin_lock+0x20/0x2c
		handle_rx_dma_xfer+0x44/0x330
		stop_rx_sequencer+0x118/0x420
		start_rx_sequencer+0xc0/0x1a0
		msm_geni_serial_runtime_resume+0x54/0xb8
		pm_generic_runtime_resume+0x44/0x80
		__rpm_callback+0x98/0x208
		rpm_resume+0x458/0x6a4
		__pm_runtime_resume+0x60/0xa0
		__device_attach.llvm.18035772682363603059+0xa0/0x174
		bus_probe_device+0x3c/0xdc
		device_add+0x95c/0xb84
		serdev_controller_add_platform+0x2c/0x1d0
		serdev_tty_port_register+0xf8/0x188
		tty_port_register_device_attr_serdev+0x50/0x90
		uart_add_one_port+0x268/0x60c
		msm_geni_serial_probe+0x630/0x780
		platform_drv_probe+0xac/0xf0
		really_probe+0x210/0x7d8.

Change-Id: I9e139897681ece174a9ead63f57bb999585ff0bf
Signed-off-by: default avatarVenkata Rao Kakani <vkakani@codeaurora.org>
parent e38c09a5
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -3305,6 +3305,13 @@ static int msm_geni_serial_probe(struct platform_device *pdev)
		dev_err(&pdev->dev, "Failed to Read FW ver: %d\n", ret);
		goto exit_geni_serial_probe;
	}
	/*
	 * In abrupt kill scenarios, previous state of the uart causing runtime
	 * resume, lead to spinlock bug in stop_rx_sequencer, so initializing it
	 * before
	 */
	if (!is_console)
		spin_lock_init(&dev_port->rx_lock);

	ret = uart_add_one_port(drv, uport);
	if (ret)
@@ -3316,8 +3323,6 @@ static int msm_geni_serial_probe(struct platform_device *pdev)
	 */
	if (uart_console(uport))
		geni_se_remove_earlycon_icc_vote(dev_port->wrapper_dev);
	else
		spin_lock_init(&dev_port->rx_lock);

	if (strcmp(id->compatible, "qcom,msm-geni-console") == 0)
		snprintf(boot_marker, sizeof(boot_marker),