]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
serial: sc16is7xx: Fix IRQ number check behavior
authorAndre Werner <andre.werner@systec-electronic.com>
Tue, 21 Jan 2025 07:18:19 +0000 (08:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Feb 2025 13:42:42 +0000 (14:42 +0100)
The logical meaning of the previous version is wrong due to a typo.

If the IRQ equals 0, no interrupt pin is available and polling mode
shall be used.

Additionally, this fix adds a check for IRQ < 0 to increase robustness,
because documentation still says that negative IRQ values cannot be
absolutely ruled-out.

Fixes: 104c1b9dde9d ("serial: sc16is7xx: Add polling mode if no IRQ pin is available")
Signed-off-by: Andre Werner <andre.werner@systec-electronic.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Maarten Brock <maarten.brock@sttls.nl>
Reviewed-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20250121071819.1346672-1-andre.werner@systec-electronic.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sc16is7xx.c

index 7b51cdc274fd8cc311d6de4ca37d03d20a4f1fab..560f45ed19aeba0f98134751f95731f21f0b81ed 100644 (file)
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
        /* Always ask for fixed clock rate from a property. */
        device_property_read_u32(dev, "clock-frequency", &uartclk);
 
-       s->polling = !!irq;
+       s->polling = (irq <= 0);
        if (s->polling)
                dev_dbg(dev,
                        "No interrupt pin definition, falling back to polling mode\n");