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

Commit 09238443 authored by Feng Tang's avatar Feng Tang Committed by Greg Kroah-Hartman
Browse files

serial: mrst_max3110: Check the irq number before enable/disabe irq in PM hooks



We should check the validity of the irq number before calling
disable_irq() and enable_irq() in the suspend/resume function,
as "max->irq == 0" means the irq is not enabled for max3110
device, otherwise it will hurt device whose irq number is really 0.

Signed-off-by: default avatarFeng Tang <feng.tang@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 12082ba2
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -749,6 +749,7 @@ static int serial_m3110_suspend(struct device *dev)
	struct spi_device *spi = to_spi_device(dev);
	struct uart_max3110 *max = spi_get_drvdata(spi);

	if (max->irq > 0)
		disable_irq(max->irq);
	uart_suspend_port(&serial_m3110_reg, &max->port);
	max3110_out(max, max->cur_conf | WC_SW_SHDI);
@@ -762,6 +763,7 @@ static int serial_m3110_resume(struct device *dev)

	max3110_out(max, max->cur_conf);
	uart_resume_port(&serial_m3110_reg, &max->port);
	if (max->irq > 0)
		enable_irq(max->irq);
	return 0;
}