Skip to content

Commit

Permalink
serial: mrst_max3110: Check the irq number before enable/disabe irq i…
Browse files Browse the repository at this point in the history
…n 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: Feng Tang <feng.tang@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Feng Tang authored and Greg Kroah-Hartman committed Oct 16, 2013
1 parent 12082ba commit 0923844
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/tty/serial/mrst_max3110.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,8 @@ static int serial_m3110_suspend(struct device *dev)
struct spi_device *spi = to_spi_device(dev);
struct uart_max3110 *max = spi_get_drvdata(spi);

disable_irq(max->irq);
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);
return 0;
Expand All @@ -762,7 +763,8 @@ static int serial_m3110_resume(struct device *dev)

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

Expand Down

0 comments on commit 0923844

Please sign in to comment.