Skip to content

Commit e6a4391

Browse files
ecree-solarflaredavem330
authored andcommitted
sfc: don't free_irq()s if they were never requested
If efx_nic_init_interrupt fails, or was never run (e.g. due to an earlier failure in ef100_net_open), freeing irqs in efx_nic_fini_interrupt is not needed and will cause error messages and stack traces. So instead, only do this if efx_nic_init_interrupt successfully completed, as indicated by the new efx->irqs_hooked flag. Fixes: 965b549 ("sfc_ef100: implement ndo_open/close and EVQ probing") Signed-off-by: Edward Cree <[email protected]> Reviewed-by: Jesse Brandeburg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 788f920 commit e6a4391

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/net/ethernet/sfc/net_driver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ struct efx_async_filter_insertion {
846846
* @timer_quantum_ns: Interrupt timer quantum, in nanoseconds
847847
* @timer_max_ns: Interrupt timer maximum value, in nanoseconds
848848
* @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
849+
* @irqs_hooked: Channel interrupts are hooked
849850
* @irq_rx_mod_step_us: Step size for IRQ moderation for RX event queues
850851
* @irq_rx_moderation_us: IRQ moderation time for RX event queues
851852
* @msg_enable: Log message enable flags
@@ -1004,6 +1005,7 @@ struct efx_nic {
10041005
unsigned int timer_quantum_ns;
10051006
unsigned int timer_max_ns;
10061007
bool irq_rx_adaptive;
1008+
bool irqs_hooked;
10071009
unsigned int irq_mod_step_us;
10081010
unsigned int irq_rx_moderation_us;
10091011
u32 msg_enable;

drivers/net/ethernet/sfc/nic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ int efx_nic_init_interrupt(struct efx_nic *efx)
129129
#endif
130130
}
131131

132+
efx->irqs_hooked = true;
132133
return 0;
133134

134135
fail2:
@@ -154,6 +155,8 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
154155
efx->net_dev->rx_cpu_rmap = NULL;
155156
#endif
156157

158+
if (!efx->irqs_hooked)
159+
return;
157160
if (EFX_INT_MODE_USE_MSI(efx)) {
158161
/* Disable MSI/MSI-X interrupts */
159162
efx_for_each_channel(channel, efx)
@@ -163,6 +166,7 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
163166
/* Disable legacy interrupt */
164167
free_irq(efx->legacy_irq, efx);
165168
}
169+
efx->irqs_hooked = false;
166170
}
167171

168172
/* Register dump */

0 commit comments

Comments
 (0)