Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

counter: 104-quad-8: Fix incorrect return value in IRQ handler

quad8_irq_handler() should return irqreturn_t enum values, but it
directly returns negative errno codes from regmap operations on error.

Return IRQ_NONE if the interrupt status cannot be read. If clearing the
interrupt fails, return IRQ_HANDLED to prevent the kernel from disabling
the IRQ line due to a spurious interrupt storm. Also, log these regmap
failures with dev_WARN_ONCE.

Fixes: 98ffe0252911 ("counter: 104-quad-8: Migrate to the regmap API")
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://lore.kernel.org/r/20251215020114.1913-1-vulab@iscas.ac.cn
Cc: stable@vger.kernel.org
Signed-off-by: William Breathitt Gray <wbg@kernel.org>

authored by

Haotian Zhang and committed by
William Breathitt Gray
9517d76d 23f94855

+14 -6
+14 -6
drivers/counter/104-quad-8.c
··· 1192 1192 { 1193 1193 struct counter_device *counter = private; 1194 1194 struct quad8 *const priv = counter_priv(counter); 1195 + struct device *dev = counter->parent; 1195 1196 unsigned int status; 1196 1197 unsigned long irq_status; 1197 1198 unsigned long channel; ··· 1201 1200 int ret; 1202 1201 1203 1202 ret = regmap_read(priv->map, QUAD8_INTERRUPT_STATUS, &status); 1204 - if (ret) 1205 - return ret; 1203 + if (ret) { 1204 + dev_WARN_ONCE(dev, true, 1205 + "Attempt to read Interrupt Status Register failed: %d\n", ret); 1206 + return IRQ_NONE; 1207 + } 1206 1208 if (!status) 1207 1209 return IRQ_NONE; 1208 1210 ··· 1227 1223 break; 1228 1224 default: 1229 1225 /* should never reach this path */ 1230 - WARN_ONCE(true, "invalid interrupt trigger function %u configured for channel %lu\n", 1231 - flg_pins, channel); 1226 + dev_WARN_ONCE(dev, true, 1227 + "invalid interrupt trigger function %u configured for channel %lu\n", 1228 + flg_pins, channel); 1232 1229 continue; 1233 1230 } 1234 1231 ··· 1237 1232 } 1238 1233 1239 1234 ret = regmap_write(priv->map, QUAD8_CHANNEL_OPERATION, CLEAR_PENDING_INTERRUPTS); 1240 - if (ret) 1241 - return ret; 1235 + if (ret) { 1236 + dev_WARN_ONCE(dev, true, 1237 + "Attempt to clear pending interrupts by writing to Channel Operation Register failed: %d\n", ret); 1238 + return IRQ_HANDLED; 1239 + } 1242 1240 1243 1241 return IRQ_HANDLED; 1244 1242 }