Re: [BUG] IB/hfi1: Warning when the driver fails to probe

From: Dennis Dalessandro
Date: Mon Apr 11 2022 - 10:25:01 EST


On 4/10/22 3:08 AM, Zheyu Ma wrote:
> Hello,
>
> I found a bug at the init_one() function in the hfi driver.
> When the function xa_alloc_irq() fails, the driver executes the error
> handling function sdma_clean(), and this function uses the lock '
> dd->sde_map_lock'. But this lock is initialized after executing the
> function xa_alloc_irq(), which causes the following warning:
>
> [ 23.257762] hfi1 0000:00:05.0: Could not allocate unit ID: error 1
> [ 23.269915] INFO: trying to register non-static key.
> [ 23.270318] The code is fine but needs lockdep annotation, or maybe
> [ 23.270808] you didn't initialize this object before use?
> [ 23.271229] turning off the locking correctness validator.
> [ 23.273198] Call Trace:
> [ 23.274185] register_lock_class+0x11b/0x880
> [ 23.274525] __lock_acquire+0xf3/0x7930
> [ 23.275769] lock_acquire+0xff/0x2d0
> [ 23.276053] ? sdma_clean+0x42a/0x660 [hfi1]
> [ 23.276485] ? lock_release+0x472/0x710
> [ 23.276789] _raw_spin_lock_irq+0x46/0x60
> [ 23.277105] ? sdma_clean+0x42a/0x660 [hfi1]
> [ 23.277530] sdma_clean+0x42a/0x660 [hfi1]
> [ 23.277945] ? trace_kfree+0x28/0xc0
> [ 23.278232] hfi1_free_devdata+0x3a7/0x420 [hfi1]
> [ 23.278688] init_one+0x867/0x11a0 [hfi1]
> [ 23.279090] ? _raw_spin_unlock_irqrestore+0x3d/0x60
> [ 23.279482] ? rcu_lock_release+0x20/0x20 [hfi1]
> [ 23.279930] pci_device_probe+0x40e/0x8d0

Thanks for the report. Will fix.

-Denny